]> git.mxchange.org Git - flightgear.git/commitdiff
Refer to property types using props:: namespace
authorTim Moore <moore@blackbox.bricoworks.com>
Fri, 17 Jul 2009 12:54:12 +0000 (14:54 +0200)
committerTim Moore <moore@blackbox.bricoworks.com>
Fri, 17 Jul 2009 12:54:12 +0000 (14:54 +0200)
BOOL, FLOAT etc. conflict with typedefs in windows.h.

src/AIModel/AIMultiplayer.cxx
src/GUI/dialog.cxx
src/GUI/property_list.cxx
src/Main/main.cxx
src/MultiPlayer/multiplaymgr.cxx
src/Network/multiplay.cxx
src/Network/props.cxx
src/Scripting/NasalSys.cxx
src/Scripting/nasal-props.cxx

index 40de4253c662b63104482fe458f63b2b8149229e..d9b44305a1468c9061771bc34354d2a3b600ebd7 100755 (executable)
@@ -97,7 +97,7 @@ void FGAIMultiplayer::unbind() {
 
 void FGAIMultiplayer::update(double dt)
 {
-  using namespace simgear::props;
+  using namespace simgear;
 
   if (dt <= 0)
     return;
@@ -202,19 +202,19 @@ void FGAIMultiplayer::update(double dt)
         {
           //cout << "Found " << pIt->second->getPath() << ":";
           switch ((*firstPropIt)->type) {
-            case INT:
-            case BOOL:
-            case LONG:
+            case props::INT:
+            case props::BOOL:
+            case props::LONG:
               pIt->second->setIntValue((*firstPropIt)->int_value);
               //cout << "Int: " << (*firstPropIt)->int_value << "\n";
               break;
-            case FLOAT:
-            case DOUBLE:
+            case props::FLOAT:
+            case props::DOUBLE:
               pIt->second->setFloatValue((*firstPropIt)->float_value);
               //cout << "Flo: " << (*firstPropIt)->float_value << "\n";
               break;
-            case STRING:
-            case UNSPECIFIED:
+            case props::STRING:
+            case props::UNSPECIFIED:
               pIt->second->setStringValue((*firstPropIt)->string_value);
               //cout << "Str: " << (*firstPropIt)->string_value << "\n";    
               break;
@@ -276,23 +276,23 @@ void FGAIMultiplayer::update(double dt)
             int ival;
             float val;
             switch ((*prevPropIt)->type) {
-              case INT:
-              case BOOL:
-              case LONG:
+              case props::INT:
+              case props::BOOL:
+              case props::LONG:
                 ival = (int) (0.5+(1-tau)*((double) (*prevPropIt)->int_value) +
                   tau*((double) (*nextPropIt)->int_value));
                 pIt->second->setIntValue(ival);
                 //cout << "Int: " << ival << "\n";
                 break;
-              case FLOAT:
-              case DOUBLE:
+              case props::FLOAT:
+              case props::DOUBLE:
                 val = (1-tau)*(*prevPropIt)->float_value +
                   tau*(*nextPropIt)->float_value;
                 //cout << "Flo: " << val << "\n";
                 pIt->second->setFloatValue(val);
                 break;
-              case STRING:
-              case UNSPECIFIED:
+              case props::STRING:
+              case props::UNSPECIFIED:
                 //cout << "Str: " << (*nextPropIt)->string_value << "\n";
                 pIt->second->setStringValue((*nextPropIt)->string_value);
                 break;
@@ -389,19 +389,19 @@ void FGAIMultiplayer::update(double dt)
       if (pIt != mPropertyMap.end())
       {
         switch ((*firstPropIt)->type) {
-          case INT:
-          case BOOL:
-          case LONG:
+          case props::INT:
+          case props::BOOL:
+          case props::LONG:
             pIt->second->setIntValue((*firstPropIt)->int_value);
             //cout << "Int: " << (*firstPropIt)->int_value << "\n";
             break;
-          case FLOAT:
-          case DOUBLE:
+          case props::FLOAT:
+          case props::DOUBLE:
             pIt->second->setFloatValue((*firstPropIt)->float_value);
             //cout << "Flo: " << (*firstPropIt)->float_value << "\n";
             break;
-          case STRING:
-          case UNSPECIFIED:
+          case props::STRING:
+          case props::UNSPECIFIED:
             pIt->second->setStringValue((*firstPropIt)->string_value);
             //cout << "Str: " << (*firstPropIt)->string_value << "\n";
             break;
index a6d4f270fc6776677b80e90cba0349f3a7016971..8fd21a333f61d3661b45842344ff3f6588802e73 100644 (file)
@@ -390,7 +390,7 @@ action_callback (puObject *object)
 static void
 copy_to_pui (SGPropertyNode *node, puObject *object)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     GUIInfo *info = (GUIInfo *)object->getUserData();
     if (!info) {
         SG_LOG(SG_GENERAL, SG_ALERT, "dialog: widget without GUIInfo!");
@@ -410,13 +410,13 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
     }
 
     switch (node->getType()) {
-    case BOOL:
-    case INT:
-    case LONG:
+    case props::BOOL:
+    case props::INT:
+    case props::LONG:
         object->setValue(node->getIntValue());
         break;
-    case FLOAT:
-    case DOUBLE:
+    case props::FLOAT:
+    case props::DOUBLE:
         object->setValue(node->getFloatValue());
         break;
     default:
@@ -430,19 +430,19 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
 static void
 copy_from_pui (puObject *object, SGPropertyNode *node)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     // puText objects are immutable, so should not be copied out
     if (object->getType() & PUCLASS_TEXT)
         return;
 
     switch (node->getType()) {
-    case BOOL:
-    case INT:
-    case LONG:
+    case props::BOOL:
+    case props::INT:
+    case props::LONG:
         node->setIntValue(object->getIntegerValue());
         break;
-    case FLOAT:
-    case DOUBLE:
+    case props::FLOAT:
+    case props::DOUBLE:
         node->setFloatValue(object->getFloatValue());
         break;
     default:
index d711d3023d85908ad8814268ee3b1b5980d68d8c..5bcb46a3542cbca9a729460102433b3fd0cfbfae 100644 (file)
@@ -44,29 +44,29 @@ typedef string stdString;      // puObject has a "string" member
 
 static string getValueTypeString(const SGPropertyNode *node)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     string result;
 
-    Type type = node->getType();
-    if (type == UNSPECIFIED)
+    props::Type type = node->getType();
+    if (type == props::UNSPECIFIED)
         result = "unspecified";
-    else if (type == NONE)
+    else if (type == props::NONE)
         result = "none";
-    else if (type == BOOL)
+    else if (type == props::BOOL)
         result = "bool";
-    else if (type == INT)
+    else if (type == props::INT)
         result = "int";
-    else if (type == LONG)
+    else if (type == props::LONG)
         result = "long";
-    else if (type == FLOAT)
+    else if (type == props::FLOAT)
         result = "float";
-    else if (type == DOUBLE)
+    else if (type == props::DOUBLE)
         result = "double";
-    else if (type == STRING)
+    else if (type == props::STRING)
         result = "string";
-    else if (type == VEC3D)
+    else if (type == props::VEC3D)
         result = "vec3d";
-    else if (type == VEC4D)
+    else if (type == props::VEC4D)
         result = "vec4d";
 
     return result;
@@ -75,12 +75,12 @@ static string getValueTypeString(const SGPropertyNode *node)
 
 static void dumpProperties(const SGPropertyNode *node)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     cout << node->getPath() << '/' << endl;
     for (int i = 0; i < node->nChildren(); i++) {
         const SGPropertyNode *c = node->getChild(i);
-        Type type = c->getType();
-        if (type == ALIAS || c->nChildren())
+        props::Type type = c->getType();
+        if (type == props::ALIAS || c->nChildren())
             continue;
 
         int index = c->getIndex();
@@ -90,25 +90,25 @@ static void dumpProperties(const SGPropertyNode *node)
         cout << " = ";
 
         switch (c->getType()) {
-        case DOUBLE:
-        case FLOAT:
-        case VEC3D:
-        case VEC4D:
+        case props::DOUBLE:
+        case props::FLOAT:
+        case props::VEC3D:
+        case props::VEC4D:
         {
             streamsize precision = cout.precision(15);
             c->printOn(cout);
             cout.precision(precision);
         }
             break;
-        case LONG:
-        case INT:
-        case BOOL:
+        case props::LONG:
+        case props::INT:
+        case props::BOOL:
             c->printOn(cout);
             break;
-        case STRING:
+        case props::STRING:
             cout << '"' << c->getStringValue() << '"';
             break;
-        case NONE:
+        case props::NONE:
             break;
         default:
             cout << '\'' << c->getStringValue() << '\'';
@@ -309,7 +309,7 @@ void PropertyList::update(bool restore_pos)
 
 void PropertyList::updateTextForEntry(NodeData& data)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     SGPropertyNode *node = data.node;
     stdString name = node->getDisplayName(true);
     stdString type = getValueTypeString(node);
@@ -323,8 +323,8 @@ void PropertyList::updateTextForEntry(NodeData& data)
         line << '/';
 
     if (!children || (_verbose && node->hasValue())) {
-        if (node->getType() == STRING
-                || node->getType() == UNSPECIFIED)
+        if (node->getType() == props::STRING
+                || node->getType() == props::UNSPECIFIED)
             sanitize(value);
 
         line << " = '" << value << "' (" << type;
index b86e9b01ecaf5661f33858bbd15f4e769504df47..d9a2516ad7336e6187adba7e94059f4080c0f9eb 100644 (file)
@@ -894,17 +894,17 @@ static void fgIdleFunction ( void ) {
 
 static void upper_case_property(const char *name)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     SGPropertyNode *p = fgGetNode(name, false);
     if (!p) {
         p = fgGetNode(name, true);
         p->setStringValue("");
     } else {
-        Type t = p->getType();
-        if (t == NONE || t == UNSPECIFIED)
+        props::Type t = p->getType();
+        if (t == props::NONE || t == props::UNSPECIFIED)
             p->setStringValue("");
         else
-            assert(t == STRING);
+            assert(t == props::STRING);
     }
     p->addChangeListener(new FGMakeUpperCase);
 }
index cf4ddd53e12add9c0fa9edf4ff9fb2b5eedfbf73..4c7a1792f72e3b52f3be0508ee1f0bca5fd545d2 100644 (file)
@@ -268,7 +268,7 @@ namespace
 {
   bool verifyProperties(const xdr_data_t* data, const xdr_data_t* end)
   {
-    using namespace simgear::props;
+    using namespace simgear;
     const xdr_data_t* xdr = data;
     while (xdr < end) {
       unsigned id = XDR_decode_uint32(*xdr);
@@ -279,13 +279,13 @@ namespace
         xdr++;
         // How we decode the remainder of the property depends on the type
         switch (plist->type) {
-        case INT:
-        case BOOL:
-        case LONG:
+        case props::INT:
+        case props::BOOL:
+        case props::LONG:
           xdr++;
           break;
-        case FLOAT:
-        case DOUBLE:
+        case props::FLOAT:
+        case props::DOUBLE:
           {
             float val = XDR_decode_float(*xdr);
             if (osg::isNaN(val))
@@ -293,8 +293,8 @@ namespace
             xdr++;
             break;
           }
-        case STRING:
-        case UNSPECIFIED:
+        case props::STRING:
+        case props::UNSPECIFIED:
           {
             // String is complicated. It consists of
             // The length of the string
index ce6f1b61e0c3a4cce77b1b785e6dee78932a0574..f6e0e30c7865f2b7000d34edb3b209f992ff31f2 100644 (file)
@@ -119,7 +119,7 @@ bool FGMultiplay::open() {
 * or receive data over the network
 ******************************************************************/
 bool FGMultiplay::process() {
-  using namespace simgear::props;
+  using namespace simgear;
   if (get_direction() == SG_IO_OUT) {
 
     // check if we have left initialization phase. That will not provide
@@ -202,17 +202,17 @@ bool FGMultiplay::process() {
       pData->type = it->second->getType();
       
       switch (pData->type) {
-        case INT:
-        case LONG:
-        case BOOL:
+        case props::INT:
+        case props::LONG:
+        case props::BOOL:
           pData->int_value = it->second->getIntValue();
           break;
-        case FLOAT:
-        case DOUBLE:
+        case props::FLOAT:
+        case props::DOUBLE:
           pData->float_value = it->second->getFloatValue();
           break;
-        case STRING:
-        case UNSPECIFIED:
+        case props::STRING:
+        case props::UNSPECIFIED:
           {
             // FIXME: We assume unspecified are strings for the moment.
 
index abbf0e5d1e1bffe4034a77eeb380e0db04d5cd15..e6760eaff1a0bce67540ff1e068473a423668786 100644 (file)
@@ -118,7 +118,7 @@ PropsChannel::collectIncomingData( const char* s, int n )
 static string
 getValueTypeString( const SGPropertyNode *node )
 {
-    using namespace simgear::props;
+    using namespace simgear;
 
     string result;
 
@@ -127,22 +127,22 @@ getValueTypeString( const SGPropertyNode *node )
         return "unknown";
     }
 
-    Type type = node->getType();
-    if ( type == UNSPECIFIED ) {
+    props::Type type = node->getType();
+    if ( type == props::UNSPECIFIED ) {
         result = "unspecified";
-    } else if ( type == NONE ) {
+    } else if ( type == props::NONE ) {
         result = "none";
-    } else if ( type == BOOL ) {
+    } else if ( type == props::BOOL ) {
         result = "bool";
-    } else if ( type == INT ) {
+    } else if ( type == props::INT ) {
         result = "int";
-    } else if ( type == LONG ) {
+    } else if ( type == props::LONG ) {
         result = "long";
-    } else if ( type == FLOAT ) {
+    } else if ( type == props::FLOAT ) {
         result = "float";
-    } else if ( type == DOUBLE ) {
+    } else if ( type == props::DOUBLE ) {
         result = "double";
-    } else if ( type == STRING ) {
+    } else if ( type == props::STRING ) {
         result = "string";
     }
 
index 4fee5cfd250e8de9f7711aeec3f347074b93fffe..c893d05103df161c33675f3e1ace2bdd57650597 100644 (file)
@@ -177,25 +177,25 @@ static SGPropertyNode* findnode(naContext c, naRef* vec, int len)
 // nil if it doesn't exist.
 static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     const SGPropertyNode* p = findnode(c, args, argc);
     if(!p) return naNil();
 
     switch(p->getType()) {
-    case BOOL:   case INT:
-    case LONG:   case FLOAT:
-    case DOUBLE:
+    case props::BOOL:   case props::INT:
+    case props::LONG:   case props::FLOAT:
+    case props::DOUBLE:
         return naNum(p->getDoubleValue());
 
-    case STRING:
-    case UNSPECIFIED:
+    case props::STRING:
+    case props::UNSPECIFIED:
         {
             naRef nastr = naNewString(c);
             const char* val = p->getStringValue();
             naStr_fromdata(nastr, (char*)val, strlen(val));
             return nastr;
         }
-    case ALIAS: // <--- FIXME, recurse?
+    case props::ALIAS: // <--- FIXME, recurse?
     default:
         return naNil();
     }
@@ -1061,24 +1061,24 @@ void FGNasalListener::childRemoved(SGPropertyNode*, SGPropertyNode* child)
 
 bool FGNasalListener::changed(SGPropertyNode* node)
 {
-    using namespace simgear::props;
-    Type type = node->getType();
-    if(type == NONE) return false;
-    if(type == UNSPECIFIED) return true;
+    using namespace simgear;
+    props::Type type = node->getType();
+    if(type == props::NONE) return false;
+    if(type == props::UNSPECIFIED) return true;
 
     bool result;
     switch(type) {
-    case BOOL:
-    case INT:
-    case LONG:
+    case props::BOOL:
+    case props::INT:
+    case props::LONG:
         {
             long l = node->getLongValue();
             result = l != _last_int;
             _last_int = l;
             return result;
         }
-    case FLOAT:
-    case DOUBLE:
+    case props::FLOAT:
+    case props::DOUBLE:
         {
             double d = node->getDoubleValue();
             result = d != _last_float;
index ab21f2a24397163d2b13406d7adac87be77ced25..83f90ab0faf2ed67003d058415cb99e51248b0f8 100644 (file)
@@ -58,21 +58,21 @@ naRef FGNasalSys::propNodeGhost(SGPropertyNode* handle)
 
 static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     NODEARG();
     const char* t = "unknown";
     switch((*node)->getType()) {
-    case NONE:   t = "NONE";   break;
-    case ALIAS:  t = "ALIAS";  break;
-    case BOOL:   t = "BOOL";   break;
-    case INT:    t = "INT";    break;
-    case LONG:   t = "LONG";   break;
-    case FLOAT:  t = "FLOAT";  break;
-    case DOUBLE: t = "DOUBLE"; break;
-    case STRING: t = "STRING"; break;
-    case UNSPECIFIED: t = "UNSPECIFIED"; break;
-    case VEC3D:  t = "VEC3D";  break;
-    case VEC4D:  t = "VEC4D";  break;
+    case props::NONE:   t = "NONE";   break;
+    case props::ALIAS:  t = "ALIAS";  break;
+    case props::BOOL:   t = "BOOL";   break;
+    case props::INT:    t = "INT";    break;
+    case props::LONG:   t = "LONG";   break;
+    case props::FLOAT:  t = "FLOAT";  break;
+    case props::DOUBLE: t = "DOUBLE"; break;
+    case props::STRING: t = "STRING"; break;
+    case props::UNSPECIFIED: t = "UNSPECIFIED"; break;
+    case props::VEC3D:  t = "VEC3D";  break;
+    case props::VEC4D:  t = "VEC4D";  break;
     }
     return NASTR(t);
 }
@@ -157,19 +157,19 @@ naRef makeVectorFromVec(naContext c, const T& vec)
 
 static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
 {
-    using namespace simgear::props;
+    using namespace simgear;
     NODEARG();
     switch((*node)->getType()) {
-    case BOOL:   case INT:
-    case LONG:   case FLOAT:
-    case DOUBLE:
+    case props::BOOL:   case props::INT:
+    case props::LONG:   case props::FLOAT:
+    case props::DOUBLE:
         return naNum((*node)->getDoubleValue());
-    case STRING:
-    case UNSPECIFIED:
+    case props::STRING:
+    case props::UNSPECIFIED:
         return NASTR((*node)->getStringValue());
-    case VEC3D:
+    case props::VEC3D:
         return makeVectorFromVec(c, (*node)->getValue<SGVec3d>());
-    case VEC4D:
+    case props::VEC4D:
         return makeVectorFromVec(c, (*node)->getValue<SGVec4d>());
     default:
         return naNil();