FileSystem.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. #ifndef DateiSystem_H
  2. #define DateiSystem_H
  3. #include <fstream>
  4. #include "Array.h"
  5. #include "Point.h"
  6. namespace Framework
  7. {
  8. class Bild; //! Image.h
  9. class Text; //! Text.h
  10. class FBalken; //! Progress.h
  11. #ifdef WIN32
  12. class Buchstabe; //! Font.h
  13. class Alphabet; //! Font.h
  14. class Schrift; //! Font.h
  15. #endif
  16. class LTDBPixel; //! from this file
  17. class LTDBKopf; //! from this file
  18. class LTDBBody; //! from this file
  19. class LTDBDatei; //! from this file
  20. class LTDSPixel; //! from this file
  21. #ifdef WIN32
  22. class LTDSDateiKopf; //! from this file
  23. class LTDSSchriftKopf; //! from this file
  24. class LTDSBuchstabenKopf; //! from this file
  25. class LTDSBuchstabenKoerper; //! from this file
  26. class LTDSDatei; //! from this file
  27. #endif
  28. //! LTDB File format --- Used for storing multiple images in one file.
  29. //! Used for storing and loading a single pixel from an image in the
  30. //! LTDB file format
  31. class LTDBPixel : public virtual ReferenceCounter //! Pixel of an LTDB file
  32. {
  33. private:
  34. LTDBPixel* davor; //! Previous pixel
  35. char index; //! Bit length of the pixel
  36. char iR, iG, iB, iA;
  37. char miR, miG, miB, miA;
  38. char maxIndex; //! Length of the pixel
  39. bool change : 1; //! Whether something changes in the following 5 variables
  40. bool changeR : 1; //! Whether Red changes
  41. bool changeG : 1; //! Whether Green changes
  42. bool changeB : 1; //! Whether Blue changes
  43. bool changeA : 1; //! Whether Alpha changes
  44. unsigned char komp : 3; //! Compression of color values
  45. unsigned char R; //! Red
  46. unsigned char G; //! Green
  47. unsigned char B; //! Blue
  48. unsigned char A; //! Alpha
  49. bool addBitZuFarbe(
  50. unsigned char bit); //! Adds a bit to the color values
  51. bool getNextFarbeBit(
  52. char& byte, int i); //! Stores the next color bit in byte
  53. public:
  54. //! Constructor
  55. //! \param davor The pixel that was loaded before. 0 if this is the
  56. //! first pixel
  57. DLLEXPORT LTDBPixel(LTDBPixel* davor);
  58. //! Destructor
  59. DLLEXPORT ~LTDBPixel();
  60. //! For loading. Adds some bits to the pixel
  61. //! \param byte The last byte read from the file
  62. //! \param begin The index of the first bit in byte where the pixel begins
  63. //! \return The index of the bit in byte where the pixel ended. -1 if
  64. //! the pixel is not finished at the end of the byte
  65. DLLEXPORT char addByte(char byte, char begin);
  66. //! For saving. Sets the color to be stored in the pixel
  67. //! \param f The color to store
  68. DLLEXPORT void setFarbe(int f);
  69. //! Compresses the pixel. Must be called before saving.
  70. DLLEXPORT void komprimieren();
  71. //! Returns a part of the bits that represent the pixel
  72. //! \param byte A reference to the byte to be saved next
  73. //! \param begin The index of the first bit in the byte where the pixel
  74. //! should be stored \return The index of the bit where the pixel ends.
  75. //! -1 if the pixel must continue in the next byte
  76. DLLEXPORT char getNextByte(char& byte, int begin);
  77. //! Returns the color value of the pixel
  78. DLLEXPORT int zuFarbe() const;
  79. //! Returns whether the red component changed compared to the previous pixel
  80. DLLEXPORT bool getChangeR() const;
  81. //! Returns whether the green component changed compared to the previous pixel
  82. DLLEXPORT bool getChangeG() const;
  83. //! Returns whether the blue component changed compared to the previous pixel
  84. DLLEXPORT bool getChangeB() const;
  85. //! Returns whether the alpha component changed compared to the previous pixel
  86. DLLEXPORT bool getChangeA() const;
  87. //! Returns the compression of the pixel
  88. DLLEXPORT unsigned char getKomp() const;
  89. //! Returns the red component of the pixel's color
  90. DLLEXPORT unsigned char getR() const;
  91. //! Returns the green component of the pixel's color
  92. DLLEXPORT unsigned char getG() const;
  93. //! Returns the blue component of the pixel's color
  94. DLLEXPORT unsigned char getB() const;
  95. //! Returns the alpha component of the pixel's color
  96. DLLEXPORT unsigned char getA() const;
  97. };
  98. //! The header of the LTDB file format. Stores information about all
  99. //! saved images
  100. class LTDBDateiKopf : public virtual ReferenceCounter
  101. {
  102. private:
  103. RCArray<Text>* bilder;
  104. Array<__int64>* pos;
  105. int bAnzahl;
  106. public:
  107. //! Constructor
  108. DLLEXPORT LTDBDateiKopf();
  109. //! Destructor
  110. DLLEXPORT ~LTDBDateiKopf();
  111. //! Removes an image from the file header
  112. //! \param i The index of the image to remove
  113. DLLEXPORT void removeBild(int i);
  114. //! Removes an image from the file header
  115. //! \param txt The name of the image to remove
  116. DLLEXPORT void removeBild(Text* txt);
  117. //! Adds an image to the file header
  118. //! \param txt The name of the image
  119. DLLEXPORT void addBild(Text* txt);
  120. //! Sets the byte index in the file where the image begins
  121. //! \param i The index of the image
  122. //! \param pos The position of the image in the file
  123. DLLEXPORT void setBildPos(int i, __int64 pos);
  124. //! Sets the byte index in the file where the image begins
  125. //! \param txt The name of the image
  126. //! \param pos The position of the image in the file
  127. DLLEXPORT void setBildPos(Text* txt, __int64 pos);
  128. //! Loads the file header of an LTDB file
  129. //! \param f A pointer to a progress bar to use for loading. Can be 0.
  130. //! \param inF The opened ifstream of the LTDB file with the read
  131. //! position already pointing to the first byte of the file header.
  132. DLLEXPORT void laden(FBalken* f, std::ifstream* inF);
  133. //! Saves the file header to an LTDB file
  134. //! \param outF The opened ofstream of the LTDB file with the write
  135. //! position already pointing to the first byte of the file header.
  136. DLLEXPORT void speichern(std::ofstream* outF) const;
  137. //! Returns the name of a specific image
  138. //! \param i The index of the image whose name should be returned
  139. //! \return The name of the image
  140. DLLEXPORT Text* getBild(int i) const;
  141. //! Returns the name of a specific image
  142. //! \param i The index of the image whose name should be returned
  143. //! \return The name of the image without increased reference counter
  144. DLLEXPORT Text* zBild(int i) const;
  145. //! Returns the index of the first byte of an image in the file
  146. //! \param txt The name of the image whose start should be found
  147. //! \return -1 if the image was not found.
  148. DLLEXPORT __int64 getBildPosition(Text* txt) const;
  149. //! Returns the index of the first byte of an image in the file.
  150. //! If the index does not exist, std::out_of_range is thrown.
  151. //! \param index The index of the image whose start should be found
  152. DLLEXPORT __int64 getBildPosition(int index) const;
  153. //! Returns the index of a specific image
  154. //! \param txt The name of the image
  155. //! \return -1 if the image was not found
  156. DLLEXPORT int getBildIndex(Text* txt) const;
  157. //! Returns the number of images in the file
  158. DLLEXPORT int getbAnzahl() const;
  159. //! Returns a list of images in the file without increased reference
  160. //! counter. The list should not be modified
  161. DLLEXPORT RCArray<Text>* zBildListe() const;
  162. };
  163. //! Information stored in the LTDB file header for a single image
  164. class LTDBKopf : public virtual ReferenceCounter
  165. {
  166. private:
  167. __int64 a; //! The LTDB file header is at most 104 bits long
  168. __int32 b; //! - up to 75 bits for the title
  169. __int8 c; //! - 12 bits for width
  170. public:
  171. //! Constructor
  172. DLLEXPORT LTDBKopf();
  173. //! Loads information about an image
  174. //! \param f The opened ifstream of the LTDB file pointing to the
  175. //! correct position
  176. DLLEXPORT void laden(std::ifstream* f);
  177. //! Sets the information to be stored
  178. //! \param titel The title of the image
  179. //! \param size The size of the image
  180. //! \return The number of characters from the title that cannot be
  181. //! stored in the LTDB file format. Only a-z, A-Z, ae ue oe ss,
  182. //! AE UE OE and . are allowed. All uppercase letters in the title
  183. //! are converted to lowercase
  184. DLLEXPORT int Init(Text* titel, const Punkt& size);
  185. //! Loads information from loaded bits. Used by the laden(
  186. //! std::ifstream) function. \param BeginBit The index of the first
  187. //! bit to evaluate \param EndBit The index of the last bit that
  188. //! should not be evaluated anymore \param bits The bits from which
  189. //! all between BeginBit and EndBit should be evaluated.
  190. //! A total of 104 bits must be set. BeginBit and EndBit refer to this
  191. //! bezihen sich BeginBit und EndBit
  192. DLLEXPORT void setBits(int BeginBit, int EndBit, __int16 bits);
  193. //! Saves the information to a file
  194. //! \param f The opened ofstream of the LTDB file pointing to the
  195. //! correct position
  196. DLLEXPORT void speichern(std::ofstream* f) const;
  197. //! Returns the length of the title
  198. DLLEXPORT int getTitelLength() const;
  199. //! Returns the title of the image
  200. DLLEXPORT Text* getTitel() const;
  201. //! Returns the size of the image
  202. DLLEXPORT Punkt getSize() const;
  203. //! Returns the next bits to be saved
  204. //! \param begin The index of the first bit to save into
  205. //! \param end The index of the last bit to save into
  206. //! \return 16 bits containing the information between begin and end.
  207. //! A total of 104 bits must be read. BeginBit and EndBit refer to this
  208. DLLEXPORT __int16 getBits(int begin, int end) const;
  209. };
  210. //! Manages the pixel data of a single image in an LTDB file
  211. class LTDBBody : public virtual ReferenceCounter
  212. {
  213. private:
  214. Punkt gr;
  215. Bild* b;
  216. int dateiSize;
  217. public:
  218. //! Constructor
  219. DLLEXPORT LTDBBody();
  220. //! Constructor
  221. //! \param k The LTDB header of the image containing information about
  222. //! the size of the image
  223. DLLEXPORT LTDBBody(LTDBKopf* k);
  224. //! Destructor
  225. DLLEXPORT ~LTDBBody();
  226. //! Sets information about the size of the image. Required for loading.
  227. //! \param k The LTDB header of the image
  228. DLLEXPORT void init(LTDBKopf k);
  229. //! Sets information about the size of the image. Required for loading.
  230. //! \param k The LTDB header of the image
  231. DLLEXPORT void init(LTDBKopf* k);
  232. //! Loads the pixel data from the file
  233. //! \param zF A progress bar that can be 0
  234. //! \param inF The opened ifstream of the LTDB file pointing to the
  235. //! correct position
  236. DLLEXPORT void laden(FBalken* zF, std::ifstream* inF);
  237. //! Sets the image to be saved
  238. //! \param b The image to save
  239. DLLEXPORT void setBild(Bild* b);
  240. //! Saves the pixel data of the image in an LTDB file
  241. //! \param zF A progress bar that can be 0
  242. //! \param outF The opened ofstream of the LTDB file pointing to the
  243. //! correct position
  244. DLLEXPORT void speichern(FBalken* zF, std::ofstream* outF) const;
  245. //! Returns the loaded image
  246. DLLEXPORT Bild* getBild() const;
  247. //! Returns the size of the image
  248. DLLEXPORT const Punkt& getSize() const;
  249. };
  250. //! Manages an LTDB file
  251. class LTDBDatei : public virtual ReferenceCounter
  252. {
  253. private:
  254. Text* pfad;
  255. LTDBDateiKopf* datKpf;
  256. public:
  257. //! Constructor
  258. DLLEXPORT LTDBDatei();
  259. //! Destructor
  260. DLLEXPORT ~LTDBDatei();
  261. //! Sets the path to the file
  262. //! \param pfad The path
  263. DLLEXPORT void setDatei(Text* pfad);
  264. //! Creates a new LTDB file
  265. DLLEXPORT void erstellen();
  266. //! Reads basic information from the file.
  267. //! Must be called before working with the file
  268. //! \param zF A progress bar that can be 0
  269. DLLEXPORT void leseDaten(FBalken* zF);
  270. //! Deletes the LTDB file
  271. DLLEXPORT void remove();
  272. //! Deletes an image from the LTDB file
  273. //! \param zF A progress bar that can be 0
  274. //! \param name The name of the image to delete
  275. DLLEXPORT void remove(FBalken* zF, Text* name);
  276. //! Loads an image from the LTDB file
  277. //! \param zF A progress bar that can be 0
  278. //! \param name The name of the image to load
  279. //! \return The loaded image. 0 if the image was not found
  280. DLLEXPORT Bild* laden(FBalken* zF, Text* name);
  281. //! Saves a new image in the LTDB file
  282. //! \param zF A progress bar that can be 0
  283. //! \param bild The image to save
  284. //! \param name The name under which the image should be saved
  285. //! \return Number of warnings that occurred while converting the name
  286. //! to a valid name. -1 if an image with the same name already exists
  287. DLLEXPORT int speichern(FBalken* zF, Bild* bild, Text* name);
  288. //! Returns a list of stored images.
  289. //! The list should not be modified
  290. DLLEXPORT RCArray<Text>* zBildListe();
  291. //! Returns the path to the LTDB file
  292. DLLEXPORT Text* getPfad() const;
  293. //! Returns the number of images in the LTDB file
  294. DLLEXPORT int getBildAnzahl() const;
  295. //! Checks whether the LTDB file exists
  296. DLLEXPORT bool istOffen() const;
  297. };
  298. #ifdef WIN32
  299. //! LTDS file format --- Used for storing fonts
  300. //! Manages a single pixel of a character
  301. class LTDSPixel : public virtual ReferenceCounter
  302. {
  303. private:
  304. char index;
  305. char iA;
  306. char miA;
  307. char maxIndex; //! Length of the pixel
  308. bool aender;
  309. bool aenderA;
  310. unsigned char komp : 3; //! Compression of the color values
  311. unsigned char alpha;
  312. LTDSPixel* davor;
  313. bool addBitZuFarbe(
  314. unsigned char bit); //! Adds a bit to the color values
  315. bool getNextFarbeBit(
  316. char& byte, int i); //! Stores the next color bit in byte
  317. public:
  318. //! Constructor
  319. //! \param davor The pixel that was loaded before this one. 0 if this
  320. //! is the first pixel
  321. DLLEXPORT LTDSPixel(LTDSPixel* davor);
  322. //! Destructor
  323. DLLEXPORT ~LTDSPixel();
  324. //! Adds some loaded bits to the pixel. For loading.
  325. //! \param byte The last byte loaded from the file.
  326. //! \param begin The index of the first bit in the byte where the pixel begins
  327. //! \return The index of the last bit in the byte where the pixel ends.
  328. //! -1 if the pixel continues in the next byte
  329. DLLEXPORT char addByte(char byte, char begin);
  330. //! Sets the alpha value of the pixel. For saving.
  331. //! \param alpha The alpha value of the pixel.
  332. DLLEXPORT void setAlpha(unsigned char alpha);
  333. //! Compresses the pixel. Must be called before saving.
  334. DLLEXPORT void Komp();
  335. //! Returns a part of the bits that represent the pixel
  336. //! \param byte A reference to the byte to be saved next
  337. //! \param begin The index of the first bit in the byte where the pixel
  338. //! should be stored \return The index of the bit in the byte where the
  339. //! pixel ends. -1 if the pixel must continue in the next byte
  340. DLLEXPORT char getNextByte(char& byte, int bbegin);
  341. //! Returns the compression of the pixel
  342. DLLEXPORT unsigned char getKomp() const;
  343. //! Returns whether the alpha value changed compared to the previous pixel
  344. DLLEXPORT bool getAEnderA() const;
  345. //! Returns the alpha value of the pixel
  346. DLLEXPORT unsigned char getA() const;
  347. };
  348. //! Manages the header of an LTDS file. Contains information about the
  349. //! font sizes stored in the file
  350. class LTDSDateiKopf : public virtual ReferenceCounter
  351. {
  352. private:
  353. unsigned char sganzahl;
  354. unsigned char* gr;
  355. int* pos;
  356. public:
  357. //! Constructor
  358. DLLEXPORT LTDSDateiKopf();
  359. //! Destructor
  360. DLLEXPORT ~LTDSDateiKopf();
  361. //! Loads the header from the LTDS file
  362. //! \param inF The opened ifstream of the LTDS file pointing to the
  363. //! correct position
  364. DLLEXPORT void laden(std::ifstream* inF);
  365. //! Adds a font size
  366. //! \param sg The font size to add
  367. DLLEXPORT void addSG(char sg);
  368. //! Deletes a font size
  369. //! \param sg The font size to delete
  370. DLLEXPORT void removeSG(char sg);
  371. //! Saves the LTDS header to the file
  372. //! \param outF The opened ofstream of the LTDS file pointing to the
  373. //! correct position
  374. DLLEXPORT void speichern(std::ofstream* outF) const;
  375. //! Returns an array of stored font sizes.
  376. //! The array should not be modified
  377. DLLEXPORT unsigned char* getSchriftGroesseList() const;
  378. //! Returns an array with positions of the first bytes for each
  379. //! font size in the file
  380. DLLEXPORT int* getPositionList() const;
  381. //! Returns the number of stored font sizes
  382. DLLEXPORT int getSchriftGroesseAnzahl() const;
  383. };
  384. //! The header of a font size. Contains information about the
  385. //! stored characters
  386. class LTDSSchriftKopf : public virtual ReferenceCounter
  387. {
  388. private:
  389. unsigned char schriftSize;
  390. unsigned char* zeichen;
  391. int* pos;
  392. unsigned char zeichenAnzahl;
  393. public:
  394. //! Constructor
  395. DLLEXPORT LTDSSchriftKopf();
  396. //! Destructor
  397. DLLEXPORT ~LTDSSchriftKopf();
  398. //! Loads the header of a font size from the file
  399. //! \param inF The opened ifstream of the LTDS file pointing to the
  400. //! correct position
  401. DLLEXPORT void laden(std::ifstream* inF);
  402. //! Sets the font size. For saving
  403. //! \param gr The font size
  404. DLLEXPORT void setSchriftgroesse(unsigned char gr);
  405. //! Sets the alphabet to be stored in the font size
  406. //! \param alphabet The alphabet containing all characters to store
  407. //! in the font size
  408. DLLEXPORT void setZeichenAlphabet(Alphabet* alphabet);
  409. //! Adds a character to the font size to be stored
  410. //! \param zeichen The ASCII code of the character to add
  411. DLLEXPORT void addZeichen(unsigned char zeichen);
  412. //! Deletes a character from the font size
  413. //! \param zeich The ASCII code of the character to delete
  414. DLLEXPORT void removeZeichen(unsigned char zeich);
  415. //! Saves the font size header to the LTDS file
  416. //! \param outF The opened ofstream of the LTDS file pointing to the
  417. //! correct position
  418. DLLEXPORT void speichern(std::ofstream* outF) const;
  419. //! Returns the font size this header belongs to
  420. DLLEXPORT unsigned char getSchriftGroesse() const;
  421. //! Returns the number of characters stored in the font size
  422. DLLEXPORT unsigned char getZeichenAnzahl() const;
  423. //! Returns an array with the positions of the first bytes of the
  424. //! stored characters in the LTDS file
  425. DLLEXPORT int* getPositionen() const;
  426. //! Returns an array with the ASCII codes of the stored characters
  427. DLLEXPORT unsigned char* getZeichen() const;
  428. };
  429. //! The header of a single character from the LTDS file. Contains
  430. //! information about the pixel size of the character
  431. class LTDSBuchstabenKopf : public virtual ReferenceCounter
  432. {
  433. private:
  434. unsigned char zeichen;
  435. Punkt size;
  436. public:
  437. //! Constructor
  438. DLLEXPORT LTDSBuchstabenKopf();
  439. //! Loads the data from the LTDS file
  440. //! \param inF The opened ifstream of the LTDS file pointing to the
  441. //! correct position
  442. DLLEXPORT void laden(std::ifstream* inF);
  443. //! Sets the data to be saved.
  444. //! \param zeichen The ASCII code of the character
  445. //! \param groesse The size of the character in pixels
  446. DLLEXPORT void init(unsigned char zeichen, const Punkt& groesse);
  447. //! Sets the data to be saved.
  448. //! \param zeichen The ASCII code of the character
  449. //! \param br The width of the character in pixels
  450. //! \param hoe The height of the character in pixels
  451. DLLEXPORT void init(unsigned char zeichen, int br, int hoe );
  452. //! Saves the data to the LTDS file
  453. //! \param outF The opened ofstream of the LTDS file pointing to the
  454. //! correct position
  455. DLLEXPORT void speichern(std::ofstream* outF) const;
  456. //! Returns the ASCII code of the character
  457. DLLEXPORT unsigned char getZeichen() const;
  458. //! Returns the width of the character in pixels
  459. DLLEXPORT int getBreite() const;
  460. //! Returns the height of the character in pixels
  461. DLLEXPORT int getHoehe() const;
  462. //! Returns the size of the character in pixels
  463. DLLEXPORT const Punkt& getGroesse() const;
  464. };
  465. //! Manages the pixel data of a character
  466. class LTDSBuchstabenKoerper : public virtual ReferenceCounter
  467. {
  468. private:
  469. Punkt size;
  470. unsigned char zeichen;
  471. Buchstabe* buchstabe;
  472. public:
  473. //! Constructor
  474. //! \param kopf The header of the character
  475. DLLEXPORT LTDSBuchstabenKoerper(LTDSBuchstabenKopf * kopf);
  476. //! Destructor
  477. DLLEXPORT ~LTDSBuchstabenKoerper();
  478. //! Sets the character to be saved
  479. //! \param zeichen The character to save
  480. DLLEXPORT void setBuchstabe(Buchstabe * zeichen);
  481. //! Loads the pixels from the LTDS file
  482. //! \param inF The opened ifstream of the LTDS file pointing to the
  483. //! correct position
  484. DLLEXPORT void laden(std::ifstream * inF);
  485. //! Saves the pixels to the LTDS file
  486. //! \param outF The opened ofstream of the LTDS file pointing to the
  487. //! correct position
  488. DLLEXPORT void speichern(std::ofstream * outF) const;
  489. //! Returns the loaded character
  490. DLLEXPORT Buchstabe* getBuchstabe() const;
  491. //! Returns the ASCII code of the character
  492. DLLEXPORT unsigned char getZeichen() const;
  493. };
  494. //! Manages an LTDS file
  495. class LTDSDatei : public virtual ReferenceCounter
  496. {
  497. private:
  498. Text* pfad;
  499. LTDSDateiKopf* dateiKopf;
  500. public:
  501. //! Constructor
  502. DLLEXPORT LTDSDatei();
  503. //! Destructor
  504. DLLEXPORT ~LTDSDatei();
  505. //! Sets the path to the file
  506. //! \param txt The path
  507. DLLEXPORT void setPfad(Text* txt);
  508. //! Loads important information from the file. Must be called before
  509. //! using the file
  510. DLLEXPORT void leseDaten();
  511. //! Adds a font size to the file if it does not already exist
  512. //! \param alphabet The alphabet containing the characters in the
  513. //! desired font size
  514. DLLEXPORT void addSchriftgroesse(Alphabet* alphabet);
  515. //! Adds a character to a font size
  516. //! \param gr The font size of the character
  517. //! \param zeich The character to save
  518. //! \param zeichen The ASCII code of the character
  519. DLLEXPORT void addBuchstabe(
  520. int gr, Buchstabe* zeich, unsigned char zeichen);
  521. //! Deletes a specific font size from the file
  522. //! \param gr The font size to remove
  523. DLLEXPORT void loescheSchrifrGroesse(int gr);
  524. //! Deletes a character from a font size
  525. //! \param gr The font size from which the character should be removed
  526. //! \param zeichen The ASCII code of the character to delete
  527. DLLEXPORT void loescheBuchstabe(int gr, unsigned char zeichen);
  528. //! Deletes the LTDS file
  529. DLLEXPORT void loescheDatei();
  530. //! Creates the LTDS file
  531. DLLEXPORT void erstelleDatei();
  532. //! Saves an entire font to the file
  533. //! \param schrift The font to save
  534. DLLEXPORT void speicherSchrift(Schrift* schrift);
  535. //! Loads the entire font from the file
  536. //! \return The loaded font. 0 if an error occurred while loading
  537. DLLEXPORT Schrift* ladeSchrift();
  538. //! Loads a single font size from the file
  539. //! \param schriftgroesse The font size to load
  540. //! \return An alphabet with the characters in the font size. 0 if
  541. //! the font size was not found
  542. DLLEXPORT Alphabet* ladeAlphabet(int schriftgroesse);
  543. //! Loads a specific character of a specific font size
  544. //! \param schriftgroesse The font size the character belongs to
  545. //! \param zeichen The ASCII code of the character to load
  546. //! \return The loaded character. 0 if the character was not found.
  547. DLLEXPORT Buchstabe* ladeBuchstabe(
  548. int schriftgroesse, unsigned char zeichen);
  549. //! Returns the path to the LTDS file
  550. DLLEXPORT Text* getPfad() const;
  551. //! Returns the number of stored font sizes
  552. DLLEXPORT int getAnzahlSchriftgroessen() const;
  553. //! Returns an array with the stored font sizes.
  554. //! The array should not be modified
  555. DLLEXPORT unsigned char* getSchriftGroessen() const;
  556. //! Returns the number of stored characters in a font size
  557. //! \param sg The font size for which the number of characters
  558. //! should be determined \return The number of characters.
  559. DLLEXPORT unsigned char getAnzahlBuchstaben(int sg);
  560. //! Returns an array with characters of a specific font size
  561. //! \param sg The font size
  562. //! \return The array with the ASCII codes of the characters. 0 if the
  563. //! font size was not found.
  564. DLLEXPORT unsigned char* getBuchstaben(int sg);
  565. };
  566. #endif
  567. //! Bit functions
  568. //! Returns 1-bits in the desired count.
  569. //! \param a The number of bits that should be 1
  570. //! \return 32 bits, where the one-bits start from the right
  571. DLLEXPORT int Bits(int a);
  572. //! Returns how many bits are needed to represent a number
  573. //! \param c The number to represent
  574. //! \return The number of required bits
  575. DLLEXPORT int getBits(char c);
  576. } // namespace Framework
  577. #endif