Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xml_serializer.cpp File Reference
#include "xml_serializer.h"
#include "cmd/unit_generic.h"
#include "cmd/images.h"
#include "vsfilesystem.h"
#include "configxml.h"
#include "vs_globals.h"
#include "vegastrike.h"
#include "networking/const.h"

Go to the source code of this file.

Functions

std::string intStarHandler (const XMLType &input, void *mythis)
 
std::string uintStarHandler (const XMLType &input, void *mythis)
 
std::string floatStarHandler (const XMLType &input, void *mythis)
 
std::string fabsFloatStarHandler (const XMLType &input, void *mythis)
 
std::string absIntStarHandler (const XMLType &input, void *mythis)
 
std::string scaledFloatStarHandler (const XMLType &input, void *mythis)
 
std::string angleStarHandler (const XMLType &input, void *mythis)
 
std::string doubleStarHandler (const XMLType &input, void *mythis)
 
std::string boolStarHandler (const XMLType &input, void *mythis)
 
std::string charStarHandler (const XMLType &input, void *mythis)
 
std::string ucharStarHandler (const XMLType &input, void *mythis)
 
std::string negationCharStarHandler (const XMLType &input, void *mythis)
 
std::string negationIntStarHandler (const XMLType &input, void *mythis)
 
std::string negationFloatStarHandler (const XMLType &input, void *mythis)
 
std::string stringStarHandler (const XMLType &input, void *mythis)
 
std::string stringHandler (const XMLType &input, void *mythis)
 
std::string intHandler (const XMLType &input, void *mythis)
 
std::string floatHandler (const XMLType &input, void *mythis)
 
std::string lessNeg1Handler (const XMLType &input, void *mythis)
 
std::string cloakHandler (const XMLType &input, void *mythis)
 
std::string intToFloatHandler (const XMLType &input, void *mythis)
 
static void Tab (VSFileSystem::VSFile &f)
 
static void Tab (VSFileSystem::VSFile &f, int level)
 
static string TabString (int level)
 

Function Documentation

std::string absIntStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 30 of file xml_serializer.cpp.

References XMLType::wordlength::i, XMLSupport::tostring(), and XMLType::w.

31 {
32  return XMLSupport::tostring( (int) abs( *input.w.i ) );
33 }
std::string angleStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 39 of file xml_serializer.cpp.

References XMLType::wordlength::f, XMLSupport::tostring(), and XMLType::w.

40 {
41  return XMLSupport::tostring( ( float( (*input.w.f)*180/3.1415926536 ) ) );
42 }
std::string boolStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 47 of file xml_serializer.cpp.

References XMLType::wordlength::b, and XMLType::w.

48 {
49  if (*input.w.b)
50  return "1";
51  return "0";
52 }
std::string charStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 53 of file xml_serializer.cpp.

References XMLType::wordlength::c, XMLSupport::tostring(), and XMLType::w.

54 {
55  return XMLSupport::tostring( *input.w.c );
56 }
std::string cloakHandler ( const XMLType input,
void *  mythis 
)

Definition at line 96 of file xml_serializer.cpp.

References XMLType::wordlength::i, XMLSupport::tostring(), and XMLType::w.

97 {
98  return XMLSupport::tostring( ( (*input.w.i) == -1 ) ? 1 : 0 ); //short fix
99 }
std::string doubleStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 43 of file xml_serializer.cpp.

References XMLType::wordlength::d, XMLSupport::tostring(), and XMLType::w.

44 {
45  return XMLSupport::tostring( (float) (*input.w.d) );
46 }
std::string fabsFloatStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 26 of file xml_serializer.cpp.

References XMLType::wordlength::f, XMLSupport::tostring(), and XMLType::w.

27 {
28  return XMLSupport::tostring( (float) fabs( *input.w.f ) );
29 }
std::string floatHandler ( const XMLType input,
void *  mythis 
)

Definition at line 87 of file xml_serializer.cpp.

References XMLType::wordlength::hardfloat, XMLSupport::tostring(), and XMLType::w.

88 {
89  return XMLSupport::tostring( input.w.hardfloat );
90 }
std::string floatStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 22 of file xml_serializer.cpp.

References XMLType::wordlength::f, XMLSupport::tostring(), and XMLType::w.

23 {
24  return XMLSupport::tostring( *input.w.f );
25 }
std::string intHandler ( const XMLType input,
void *  mythis 
)

Definition at line 83 of file xml_serializer.cpp.

References XMLType::wordlength::hardint, XMLSupport::tostring(), and XMLType::w.

84 {
85  return XMLSupport::tostring( input.w.hardint );
86 }
std::string intStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 14 of file xml_serializer.cpp.

References XMLType::wordlength::i, XMLSupport::tostring(), and XMLType::w.

15 {
16  return XMLSupport::tostring( *input.w.i );
17 }
std::string intToFloatHandler ( const XMLType input,
void *  mythis 
)

Definition at line 101 of file xml_serializer.cpp.

References XMLType::wordlength::i, XMLSupport::tostring(), and XMLType::w.

102 {
103  return XMLSupport::tostring( (float) ( ( (float) (*input.w.i) )/( (float) (2147483647) ) ) );
104 }
std::string lessNeg1Handler ( const XMLType input,
void *  mythis 
)

Definition at line 91 of file xml_serializer.cpp.

References XMLType::wordlength::c, XMLSupport::tostring(), and XMLType::w.

92 {
93  return XMLSupport::tostring( ( (*input.w.c) < -1 ) ? 1 : 0 );
94 }
std::string negationCharStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 61 of file xml_serializer.cpp.

References XMLType::wordlength::c, XMLSupport::tostring(), and XMLType::w.

62 {
63  return XMLSupport::tostring( -(*input.w.c) );
64 }
std::string negationFloatStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 69 of file xml_serializer.cpp.

References XMLType::wordlength::f, XMLSupport::tostring(), and XMLType::w.

70 {
71  return XMLSupport::tostring( -(*input.w.f) );
72 }
std::string negationIntStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 65 of file xml_serializer.cpp.

References XMLType::wordlength::i, XMLSupport::tostring(), and XMLType::w.

66 {
67  return XMLSupport::tostring( -(*input.w.i) );
68 }
std::string scaledFloatStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 34 of file xml_serializer.cpp.

References XMLType::wordlength::f, XMLSupport::parse_float(), XMLType::str, XMLSupport::tostring(), and XMLType::w.

35 {
36  return XMLSupport::tostring( (float) ( (*input.w.f)/XMLSupport::parse_float( input.str ) ) );
37 }
std::string stringHandler ( const XMLType input,
void *  mythis 
)

Definition at line 79 of file xml_serializer.cpp.

References XMLType::str.

80 {
81  return input.str;
82 }
std::string stringStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 73 of file xml_serializer.cpp.

References XMLType::wordlength::p, and XMLType::w.

74 {
75  if (!input.w.p)
76  return string( "" );
77  return *( (string*) (input.w.p) );
78 }
static void Tab ( VSFileSystem::VSFile f)
static

Definition at line 110 of file xml_serializer.cpp.

References VSFileSystem::VSFile::Fprintf().

111 {
112  f.Fprintf( "\t" );
113 }
static void Tab ( VSFileSystem::VSFile f,
int  level 
)
static

Definition at line 114 of file xml_serializer.cpp.

References i, BeamXML::level, and StarSystemGent::Tab().

115 {
116  for (int i = 0; i < level; i++)
117  Tab( f );
118 }
static string TabString ( int  level)
static

Definition at line 152 of file xml_serializer.cpp.

References i, and BeamXML::level.

Referenced by XMLnode::WriteString().

153 {
154  string ret = "";
155  for (int i = 0; i < level; i++)
156  ret += '\t';
157  return ret;
158 }
std::string ucharStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 57 of file xml_serializer.cpp.

References XMLSupport::tostring(), XMLType::wordlength::uc, and XMLType::w.

58 {
59  return XMLSupport::tostring( *input.w.uc );
60 }
std::string uintStarHandler ( const XMLType input,
void *  mythis 
)

Definition at line 18 of file xml_serializer.cpp.

References XMLSupport::tostring(), XMLType::wordlength::ui, and XMLType::w.

19 {
20  return XMLSupport::tostring( *input.w.ui );
21 }