Torque3D Documentation / _generateds / propertyParsing.h

propertyParsing.h

Engine/source/console/propertyParsing.h

More...

Namespaces:

namespace

Public Defines

define
DEFINE_PROPERTY_DEFAULT_PRINT(dataType) bool ( & resultString, dataType  & dataTyped)
define
DEFINE_PROPERTY_DEFAULT_SCAN(dataType) bool (  &dataString, dataType & resultTyped)

Detailed Description

Public Defines

DEFINE_PROPERTY_DEFAULT_PRINT(dataType) bool ( & resultString, dataType  & dataTyped)
DEFINE_PROPERTY_DEFAULT_SCAN(dataType) bool (  &dataString, dataType & resultTyped)
  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _PROPERTYPARSING_H_
 25#define _PROPERTYPARSING_H_
 26
 27class ColorI;
 28class LinearColorF;
 29class Point2I;
 30class Point2F;
 31class Point3F;
 32class Point4F;
 33class Point3I;
 34class Point4I;
 35class RectI;
 36class RectF;
 37class Box3I;
 38class Box3F;
 39class MatrixF;
 40class AngAxisF;
 41class QuatF;
 42class String;
 43class FileName;
 44class SimObject;
 45class SimObjectType;
 46template<class T> class Vector;
 47
 48//-----------------------------------------------------------------------------
 49// String scan/print methods
 50//
 51// Macros in propertyImplementation.h point the ConcretePropertyDefinition scan/print delegates to these functions.
 52//
 53namespace PropertyInfo
 54{
 55   // String
 56   bool default_scan(const String &data, String & result);
 57   bool default_print(String & result, const String & data);
 58
 59   // Bool
 60   bool default_scan(const String &data, bool & result);
 61   bool default_print(String & result, const bool & data);
 62
 63   // S32/F32/U32
 64   bool default_scan(const String &data, F32 & result);
 65   bool default_print(String & result, const F32 & data);
 66   bool default_scan(const String &data, U32 & result);
 67   bool default_print(String & result, const U32 & data);
 68   bool default_scan(const String &data, S32 & result);
 69   bool default_print(String & result, const S32 & data);
 70
 71   // Vector<S32/F32/U32>
 72   bool default_scan(const String &data, Vector<F32> & result);
 73   bool default_print(String & result, const Vector<F32> & data);
 74   bool default_scan(const String &data, Vector<U32> & result);
 75   bool default_print(String & result, const Vector<U32> & data);
 76   bool default_scan(const String &data, Vector<S32> & result);
 77   bool default_print(String & result, const Vector<S32> & data);
 78
 79   // Math Points
 80   bool default_scan(const String &data, Point2F & result);
 81   bool default_print(String & result, const Point2F & data);
 82   bool default_scan(const String &data, Point2I & result);
 83   bool default_print(String & result, const Point2I & data);
 84   bool default_scan(const String &data, Point3F & result);
 85   bool default_print(String & result, const Point3F & data);
 86   bool default_scan(const String &data, Point3I & result);
 87   bool default_print(String & result, const Point3I & data);
 88   bool default_scan(const String &data, Point4F & result);
 89   bool default_print(String & result, const Point4F & data);
 90   bool default_scan(const String &data, Point4I & result);
 91   bool default_print(String & result, const Point4I & data);
 92
 93   // Math Boxs & Rectangles
 94   bool default_scan(const String &data, RectI & result);
 95   bool default_print(String & result, const RectI & data);
 96   bool default_scan(const String &data, RectF & result);
 97   bool default_print(String & result, const RectF & data);
 98   bool default_scan(const String &data, Box3I & result);
 99   bool default_print(String & result, const Box3I & data);
100   bool default_scan(const String &data, Box3F & result);
101   bool default_print(String & result, const Box3F & data);
102
103   //-----------------------------------------------------------------------------
104   bool default_scan( const String &data, AngAxisF & result );
105   bool default_print( String & result, const AngAxisF & data );
106
107   bool default_scan( const String &data, QuatF & result );
108   bool default_print( String & result, const QuatF & data );
109
110   bool default_scan( const String &data, MatrixF & result );
111   bool default_print( String & result, const MatrixF & data );
112
113   // Colors
114   bool default_scan(const String &data, LinearColorF & result);
115   bool default_print(String & result, const LinearColorF & data);
116   bool default_scan(const String &data, ColorI & result);
117   bool default_print(String & result, const ColorI & data);
118
119   // filename handler
120   bool default_scan(const String &data, FileName & result);
121   bool default_print(String & result, const FileName & data);
122
123   // SimObjectType
124   bool default_scan(const String &data, SimObjectType & result);
125   bool default_print(String & result, SimObjectType const & data);
126
127   // SimObject
128   bool default_scan(const String &data, SimObject * & result);
129   bool default_print(String & result, SimObject * const & data);
130
131   template<class T>
132   inline bool typed_simobject_scan(const String &data, T * & result)
133   {
134      SimObject * obj;
135      result = default_scan(data,obj)? dynamic_cast<T*>(obj) : NULL;
136      return result;
137   }
138
139   template<class T>
140   inline bool typed_simobject_print(String & result, T * const & data)
141   {
142      return default_print(result,data);
143   }
144
145   bool hex_scan(const String & string, U32 & hex);
146   bool hex_print(String & string, const U32 & hex);
147   bool hex_scan(const String & string, S32 & hex);
148   bool hex_print(String & string, const S32 & hex);
149
150   bool hex_scan(const String & string, U16 & hex);
151   bool hex_print(String & string, const U16 & hex);
152   bool hex_scan(const String & string, S16 & hex);
153   bool hex_print(String & string, const S16 & hex);
154
155   bool hex_scan(const String & string, U8 & hex);
156   bool hex_print(String & string, const U8 & hex);
157   bool hex_scan(const String & string, S8 & hex);
158   bool hex_print(String & string, const S8 & hex);
159
160   bool default_print(String & result, SimObjectType * const & data);
161}
162
163// Default Scan/print definition
164#define DEFINE_PROPERTY_DEFAULT_PRINT(dataType) bool PropertyInfo::default_print(String & resultString, dataType const & dataTyped)
165#define DEFINE_PROPERTY_DEFAULT_SCAN(dataType) bool PropertyInfo::default_scan(const String &dataString, dataType & resultTyped)
166
167#endif // _PROPERTYPARSING_H_
168