| 
    osgEarth 2.1.1 
   | 
 
Outputs a Value in JSON format without formatting (not human friendly). More...
 Inheritance diagram for osgEarth::Json::FastWriter:
 Collaboration diagram for osgEarth::Json::FastWriter:Public Member Functions | |
| FastWriter () | |
| virtual | ~FastWriter () | 
| void | enableYAMLCompatibility () | 
| virtual std::string | write (const Value &root) | 
Private Member Functions | |
| void | writeValue (const Value &value) | 
Private Attributes | |
| std::string | document_ | 
| bool | yamlCompatiblityEnabled_ | 
Outputs a Value in JSON format without formatting (not human friendly).
The JSON document is written in a single line. It is not intended for 'human' consumption, but may be usefull to support feature such as RPC where bandwith is limited.
| FastWriter::FastWriter | ( | ) | 
Definition at line 2874 of file JsonUtils.cpp.
: yamlCompatiblityEnabled_( false ) { }
| virtual osgEarth::Json::FastWriter::~FastWriter | ( | ) |  [inline, virtual] | 
        
| void FastWriter::enableYAMLCompatibility | ( | ) | 
Definition at line 2881 of file JsonUtils.cpp.
{
   yamlCompatiblityEnabled_ = true;
}
| std::string FastWriter::write | ( | const Value & | root | ) |  [virtual] | 
        
Implements osgEarth::Json::Writer.
Definition at line 2888 of file JsonUtils.cpp.
{
   document_ = "";
   writeValue( root );
   document_ += "\n";
   return document_;
}
 Here is the call graph for this function:| void FastWriter::writeValue | ( | const Value & | value | ) |  [private] | 
        
Definition at line 2898 of file JsonUtils.cpp.
{
   switch ( value.type() )
   {
   case nullValue:
      document_ += "null";
      break;
   case intValue:
      document_ += valueToString( value.asInt() );
      break;
   case uintValue:
      document_ += valueToString( value.asUInt() );
      break;
   case realValue:
      document_ += valueToString( value.asDouble() );
      break;
   case stringValue:
      document_ += valueToQuotedString( value.asCString() );
      break;
   case booleanValue:
      document_ += valueToString( value.asBool() );
      break;
   case arrayValue:
      {
         document_ += "[";
         int size = value.size();
         for ( int index =0; index < size; ++index )
         {
            if ( index > 0 )
               document_ += ",";
            writeValue( value[index] );
         }
         document_ += "]";
      }
      break;
   case objectValue:
      {
         Value::Members members( value.getMemberNames() );
         document_ += "{";
         for ( Value::Members::iterator it = members.begin(); 
               it != members.end(); 
               ++it )
         {
            const std::string &name = *it;
            if ( it != members.begin() )
               document_ += ",";
            document_ += valueToQuotedString( name.c_str() );
            document_ += yamlCompatiblityEnabled_ ? ": " 
                                                  : ":";
            writeValue( value[name] );
         }
         document_ += "}";
      }
      break;
   }
}
 Here is the call graph for this function:
 Here is the caller graph for this function:std::string osgEarth::Json::FastWriter::document_ [private] | 
        
bool osgEarth::Json::FastWriter::yamlCompatiblityEnabled_ [private] | 
        
 1.7.3