Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
BaseValueType.hpp
Go to the documentation of this file.
1 //
2 // BEGIN_DOUGLAS_MARK_ROYER_COPYRIGHT
3 //
4 // Copyright (C) 2000-2014 Douglas Mark Royer, All Rights Reserved.
5 //
6 // NOTICE:
7 //
8 // THIS SOURCE CODE BELONGS TO DOUGLAS MARK ROYER THIS CODE
9 // IS CONSIDERED A TRADE SECRET AND IS NOT TO BE DIVULGED OR
10 // USED BY PARTIES WHO HAVE NOT RECEIVED WRITTEN AUTHORIZATION FROM THE OWNER.
11 //
12 // THIS SOFTWARE AND MANUAL ARE BOTH PROTECTED BY UNITED STATES
13 // COPYRIGHT LAW (TITLE 17 UNITED STATES CODE). UNAUTHORIZED REPRODUCTION
14 // AND/OR SALE MAY RESULT IN IMPRISONMENT OF UP TO ONE YEAR AND FINES
15 // OF UP TO $100,000 (17 USC 506). COPYRIGHT INFRINGERS MAY ALSO
16 // BE SUBJECT TO CIVIL LIABILITY.
17 //
18 // THIS NOTICE AND THE ABOVE COPYRIGHT NOTICE MUST REMAIN IN ALL
19 // COPIES AND ANY DERIVED WORK.
20 //
21 // ALL OF THIS CODE IS ORIGINAL WORK BY THE COPYRIGHT HOLDER.
22 //
23 // THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN IS
24 // PROVIDED ON AN "AS IS" BASIS AND THE OWNER
25 // DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
26 // NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
27 // HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
28 // WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
29 // PURPOSE.
30 //
31 // ANY SERVICE CONTRACT WILL BE UNDER A SEPARATE LICENSE.
32 //
33 // END_DOUGLAS_MARK_ROYER_COPYRIGHT
34 //
35 
43 #ifndef __DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_VALUE_BASE_HPP__
44 #define __DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_VALUE_BASE_HPP__
45 
46 #ifndef EXPORT_ICALENDAR
47 #ifdef BUILDING_LIBRARY_ICALENDAR
48 #define EXPORT_ICALENDAR EXPORT_OUT
49 #else
50 #define EXPORT_ICALENDAR EXPORT_IN
51 #endif
52 #endif
53 
54 #include <SaS/Common/String.hpp>
55 
56 #ifdef BUILDING_LIBRARY_ICALENDAR
57 #include "iCalendar.hpp"
58 #include "iCalError.hpp"
59 #else
60 #include <SaS/iCalendar/iCalendar.hpp>
61 #include <SaS/iCalendar/iCalError.hpp>
62 #endif
63 
64 using namespace std;
67 
68 namespace SoftwareAndServices
69 {
70  namespace Library
71  {
72  namespace iCalendar
73  {
74  class value;
75 
80  class EXPORT_ICALENDAR BaseValueType
81  : virtual public instance<BaseValueType>
82  {
83 
84  public:
85 
89  friend class TokenValue;
90 
98  BaseValueType(Tokens_t storedType, const value * data);
99 
103  virtual ~BaseValueType();
104 
110  void operator delete(void * data);
111 
119  virtual bool sprint(String * Results) const = 0;
120 
131  static bool sprintTokensAsText(String * Results,
132  Tokens_t token);
133 
144  static const char ** tokenStrings;
145 
154  void setType(Tokens_t Token);
155 
164  Tokens_t getType() const;
165 
171  const value * getData() const;
172 
178  void setData(void * DataPtr);
179 
188  void setXValueType(const char * xValType);
189 
198  const char * getXValueType() const;
199 
205  NO_END_QUOTE_e = 1,
206  NO_DATA_PROVIDED_e,
207  UNKNOWN_BACKSLASH_ESCAPE_e,
208  NO_TERM_FOUND_e
209  };
210 
223  static char * unescape(const char * text,
224  const char * term);
225 
234  static char * escape(const char * text);
235 
245  static char * removeQuotes(const char * text);
246 
254  static char * addQuotes(const char * text);
255 
256  private:
257  Tokens_t _type;
258  const value * _data;
259  const char * _xValueType;
260 
261  static void _BaseValueType_once_proc();
262  static void _initTokenStrings();
263 
264  friend Tokens_t text2token(const char * cValue, size_t len);
265  };
266 
270  typedef vector<BaseValueType*> BaseValueTypeVec;
271  }
272  }
273 }
274 
275 #endif /*__DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_VALUE_BASE_HPP__*/
static const char ** tokenStrings
A list of strings for the names of tokens.
quote_errors
These are C++ objects that can be thrown as errors.
STL namespace.
This class represents any iCalendar TEXT value type.
Definition: text.hpp:76
vector< BaseValueType * > BaseValueTypeVec
An array of BaseValueType objects.
This is the base class for all values, that includes parameters and properties.
Definition: value.hpp:78
EXPORT_ICALENDAR Tokens_t text2token(const char *TokenString, size_t Length=0)
Convert a string into an object token ID.
Instance counting and tracking.
Definition: instance.hpp:90
This is a class that allows:
Definition: String.hpp:114
Copyright Douglas Mark Royer DouglasRoyer@gmail.com.
Definition: Base.hpp:98
The base class for calendar objects.
Definition: iCalendar.hpp:434
All (almost all) values are derived from this base class.
This class represents any iCalendar value that can be represented as a Tokens_t.
Definition: TokenValue.hpp:78