Portability Libraries  2015.2.0.0
Common Methods and Objects for Platform Independance.
Sql2C++/lib/SQLLINE.hpp
Go to the documentation of this file.
1 /**
2  * Copyright Douglas Mark Royer
3  * DouglasRoyer@gmail.com
4  */
5 
6 #ifndef _DOUGLAS_MARK_ROYER_SQL_TOOLS_SQLLINE_HPP
7 #define _DOUGLAS_MARK_ROYER_SQL_TOOLS_SQLLINE_HPP
8 
9 #ifdef BUILDING_LIBSQL2CPP
10 #include "SQLPOINT.hpp"
11 #else
12 #include <SaS/Sql2Cpp/SQLPOINT.hpp>
13 #endif
14 
15 namespace SoftwareAndServices
16 {
17  namespace Library
18  {
19  namespace Database
20  {
21  /**
22  * @class SQLLINE SQLLINE.hpp <SaS/Sql2Cpp/SQLLINE.hpp>
23  * An object that represents a line.
24  */
25  class SQLLINE
26  : public SqlColumn
27  {
28 
29  public:
30 
31  /**
32  * SQLLINE - Default Constructor.
33  */
34  SQLLINE();
35 
36  /**
37  * SQLLINE - Copy Constructor.
38  *
39  * @param CopyFrom The SQLLINE object to copy from.
40  */
41  SQLLINE(const SQLLINE & CopyFrom);
42 
43  /**
44  * SQLLINE - Constructor.
45  *
46  * @param Val The value as provded from SELECT.
47  */
48  SQLLINE(const char * Val);
49 
50  /**
51  * SQLLINE - Constructor.
52  *
53  * @param One The first corner.
54  *
55  * @param Two The second corner
56  */
57  SQLLINE(const SQLPOINT & One, const SQLPOINT & Two);
58 
59  /**
60  * SQLLINE - Constructor.
61  *
62  * @param X1 One corner X Value.
63  *
64  * @param Y1 One corner Y Value.
65  *
66  * @param X2 Second corner X Value.
67  *
68  * @param Y2 Second corner Y Value.
69  */
70  SQLLINE(const SQLNUMERIC & X1,
71  const SQLNUMERIC & Y1,
72  const SQLNUMERIC & X2,
73  const SQLNUMERIC & Y2);
74 
75  /**
76  * SQLLINE - Destructor.
77  */
78  virtual ~SQLLINE();
79 
80  /**
81  * Generate the HPP (C++ header files) code to
82  * set/get the value.
83  *
84  * @param Fp Where to print to.
85  */
86  virtual void GenerateHpp(FILE * Fp,
87  const SqlTable & Parent) const;
88 
89  /**
90  * Generate the CPP code to set/get the value.
91  *
92  * @param Fp Where to print to.
93  */
94  virtual void GenerateCpp(FILE * Fp,
95  const SqlTable & Parent) const;
96 
97  /**
98  * Generate the QT5 UI form.
99  *
100  * @param Parent The parent SqlTable.
101  */
102  virtual void GenerateUi(xmlTextWriterPtr Xml, const SqlTable & Parent) const;
103 
104  /**
105  * Set the values.
106  *
107  * @param One The first corner.
108  *
109  * @param Two The second corner.
110  */
111  void Set(const SQLPOINT & One, const SQLPOINT & Two);
112 
113  /**
114  * Set the values.
115  *
116  * @param X1 One corner X Value.
117  *
118  * @param Y1 One corner Y Value.
119  *
120  * @param X2 Second corner X Value.
121  *
122  * @param Y2 Second corner Y Value.
123  */
124  void Set(const SQLNUMERIC & X1,
125  const SQLNUMERIC & Y1,
126  const SQLNUMERIC & X2,
127  const SQLNUMERIC & Y2);
128 
129  /**
130  * Get the value.
131  *
132  * @param One The first corner.
133  *
134  * @param Two The second corner.
135  */
136  void Get(SQLPOINT & One, SQLPOINT & Two) const;
137 
138  /**
139  * Get the value.
140  *
141  * @param X1 One corner X Value.
142  *
143  * @param Y1 One corner Y Value.
144  *
145  * @param X2 Second corner X Value.
146  *
147  * @param Y2 Second corner Y Value.
148  */
149  void Get(SQLNUMERIC & X1,
150  SQLNUMERIC & Y1,
151  SQLNUMERIC & X2,
152  SQLNUMERIC & Y2) const;
153 
154  /**
155  * Get the C++ base type name.
156  * (int32_t, SQLTIMESTAMP, double, (char*), ...)
157  */
158  virtual const char * BaseType() const;
159 
160  /**
161  * Copy the line, return (*this) updated.
162  *
163  * @param CopyFrom the SQLLINE object to copy from.
164  *
165  * @return (*this) updated from CopyFrom.
166  */
167  SQLLINE & operator=(const SQLLINE & CopyFrom);
168 
169  /**
170  * Compare this object to CompareTo.
171  *
172  * @param CompareTo The SQLLINE obejct to compare to.
173  *
174  * @return true when they are the same.
175  */
176  bool operator==(const SQLLINE & CompareTo) const;
177 
178  /**
179  * Compare this object to CompareTo.
180  *
181  * @param CompareTo The SQLLINE obejct to compare to.
182  *
183  * @return true when they are <b>not</b> the same.
184  */
185  bool operator!=(const SQLLINE & CompareTo) const;
186 
187  /**
188  * Convert the object value to a string.
189  *
190  * Output format: (x1,y1),(x2,y2)
191  */
192  virtual const char * toString() const;
193 
194  /**
195  * Convert the object value from a string.
196  *
197  * @param TheValue The value to convert to the data type.
198  * Input formats:
199  *
200  * ((x1,y1),(x2,y2))
201  *
202  * (x1,y1),(x2,y2)
203  *
204  * x1,y1,x2,y2
205  */
206  virtual bool fromString(const char * TheValue);
207 
208  /**
209  * Copy this object.
210  *
211  * @return A new copy of this object.
212  */
213  virtual DataTypeBase * Copy() const;
214 
215  private:
216 
217  /**
218  * The first corner.
219  */
220  SQLPOINT * _One;
221 
222  /**
223  * The second corner.
224  */
225  SQLPOINT * _Two;
226 
227  };
228  }
229  }
230 }
231 #endif //_DOUGLAS_MARK_ROYER_SQL_TOOLS_SQLLINE_HPP
void Set(const SQLPOINT &One, const SQLPOINT &Two)
SQLLINE & operator=(const SQLLINE &CopyFrom)
void Get(SQLPOINT &One, SQLPOINT &Two) const
virtual void GenerateCpp(FILE *Fp, const SqlTable &Parent) const
virtual void GenerateUi(xmlTextWriterPtr Xml, const SqlTable &Parent) const
virtual bool fromString(const char *TheValue)
virtual const char * toString() const
virtual const char * BaseType() const
virtual void GenerateHpp(FILE *Fp, const SqlTable &Parent) const
SQL * Database
virtual DataTypeBase * Copy() const
bool operator!=(const SQLLINE &CompareTo) const
bool operator==(const SQLLINE &CompareTo) const