The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cTypeComments.h
Go to the documentation of this file.
1 /**
2  * @class cTypeComments
3  * file name: cTypeComments.h
4  * @author Betti Oesterholz
5  * @date 25.07.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents an Fib -commentscountertype.
11  * Copyright (C) @c LGPL3 2009 Betti Oesterholz
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License (LGPL) as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  *
27  * This file contains the class of Fib -commentscountertype.
28  * Fib -commentscountertype are typs for the number of comments, when
29  * they are stored. When saving comments they will be numbered serially,
30  * the numbers of the comments will come from the domain for the
31  * cTypeComments. The commentsstrings will be exported to the root
32  * optional part.
33  *
34  */
35 /*
36 History:
37 25.07.2010 Oesterholz created
38 12.02.2012 Oesterholz restoreXml*() without restoring domain possible
39 */
40 
41 #ifndef ___C_TYPE_COMMENTS_H__
42 #define ___C_TYPE_COMMENTS_H__
43 
44 
45 #include "cTypeElement.h"
46 
47 
48 namespace fib{
49 
50 
52 
53 public:
54  /**
55  * Standardconstructor for the comments type.
56  */
57  cTypeComments();
58 
59  /**
60  * This Function returns for the type of the element an number.
61  * The values, which are returned, mean:
62  * - 1: cTypeDimension
63  * - 2: cTypeUnderArea
64  * - 3: cTypeUnderFunction
65  * - 5: cTypeInVar
66  * - 6: cTypeProperty
67  * - 10: cTypeVariable
68  * - 11: cTypeComments
69  * - 12: cTypeExtObject
70  * - 13: cTypeExtSubobject
71  * - 14: cTypeFibSet
72  * - 15: cTypeFibMatrix
73  * - 16: cTypeExtObjectInput
74  *
75  * @return for the type of the element an number
76  */
77  virtual unsignedIntFib getType() const;
78 
79 
80  /**
81  * This method checks, if this element type is compatible with the
82  * given domain. Just domains which are compadible can be used for the
83  * elements of this type.
84  *
85  * @param domain the domain, which should be compatible
86  * @return true if the given domain is compatible, else false
87  */
88  virtual bool isCompatible( const cDomain &domain ) const;
89 
90 
91  /**
92  * This Method returns a pointer to a new instance of the standart
93  * domain for elements of this type.
94  * You have to delete the returned object after usage.
95  *
96  * @return the standart domain for elements of this type
97  */
98  virtual cDomain * getStandardDomain( ) const;
99 
100 
101  /**
102  * This Method checks if the given type is equal to this type.
103  *
104  * @return true if the given type is equal to this type, else false
105  */
106  virtual bool operator==( const cTypeElement &typeElement ) const;
107 
108 
109  /**
110  * This Method clones this object.
111  *
112  * @return a clone of this object
113  */
114  virtual cTypeComments * clone() const;
115 
116  /**
117  * This method evaluades the size of the typeelement in bits in the
118  * compressed file form.
119  *
120  * @see store()
121  * @return the size of the typeelement in bits in the compressed form
122  */
123  virtual unsignedLongFib getCompressedSize() const;
124 
125  /**
126  * This method stores this type in the XML -format into the
127  * given stream.
128  *
129  * @param ostream the stream where domains should be stored to
130  * @param domain the domain which should be stored to this type;
131  * if a Nullpointer NULL (the standardvalue) is given, no domain
132  * will be stored to this type
133  * @return true if this type are stored, else false
134  */
135  virtual bool storeXml( ostream & ostream,
136  const cDomain * domain = NULL ) const;
137 
138  /**
139  * This method restores a type with a domain in the XML -format from an
140  * TinyXml element.
141  *
142  * @param pXmlNode a pointer to the TinyXml node wher the type is stored in
143  * @param outStatus an integer value with the errorvalue
144  * possible errorvalues are:
145  * - 0 loading successful
146  * - -1 loading error, invalid pXmlElement
147  * - -2 loading error, invalid data in pXmlElement
148  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
149  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
150  * object is wrong
151  * @param bRestoreDomain if true a domain is to be asumed in the type
152  * element and it will be restored, else no domain will be restores
153  * @return a pointer to the restored domain, or NULL if it couldn't be restored
154  */
155  virtual cDomain * restoreXmlWithDomain( const TiXmlElement * pXmlElement,
156  intFib & outStatus, const bool bRestoreDomain = true );
157 
158  /**
159  * This method stores this typeelement in the compressed fib -format
160  * into the given stream.
161  * It is needed because the stream can yust store byts but the size of
162  * fib -elements can be any number of bits. Because of that ther have to
163  * be a possibility to exchange the missing bits betwean the fib -elements.
164  *
165  * @see cFibElement::store
166  * @param stream the stream where this typeelement should be stored to
167  * @param cRestBits the not yet writen bits which should be stored
168  * @param uiRestBitPosition the number of bits in the cRestBits which
169  * should be writen respectively containing valid information
170  * @return true if the typeelement is stored, else false
171  */
172  virtual bool store( ostream & stream, char & cRestBits,
173  unsigned char & uiRestBitPosition ) const;
174 
175  /**
176  * This method restores a type from a bitstream, wher it is
177  * stored in the compressed fib -format.
178  *
179  * @see store
180  * @param iBitStream the stream where the type is stored in,
181  * because the stream is an cReadBits, any number of bits can be
182  * readed from it
183  * @return an integervalue with the errorvalue
184  * possible errorvalues are:
185  * - 0 loading successful
186  * - -1 loading error, invalid pXmlElement
187  * - -2 loading error, invalid data in pXmlElement
188  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
189  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
190  * object is wrong
191  */
192  virtual intFib restore( cReadBits & iBitStream );
193 
194 
195 };//end class cTypeComments
196 
197 
198 }//end namespace fib
199 
200 #endif //___C_TYPE_COMMENTS_H__