@@ -4010,137 +4010,223 @@ void SymbolDatabase::printOut(const char *title) const
4010
4010
4011
4011
void SymbolDatabase::printXml (std::ostream &out) const
4012
4012
{
4013
- out << std::setiosflags (std::ios::boolalpha) ;
4013
+ std::string outs ;
4014
4014
4015
4015
std::set<const Variable *> variables;
4016
4016
4017
4017
// Scopes..
4018
- out << " <scopes>" << std::endl ;
4018
+ outs += " <scopes>\n " ;
4019
4019
for (std::list<Scope>::const_iterator scope = scopeList.cbegin (); scope != scopeList.cend (); ++scope) {
4020
- out << " <scope" ;
4021
- out << " id=\" " << &*scope << " \" " ;
4022
- out << " type=\" " << scope->type << " \" " ;
4023
- if (!scope->className .empty ())
4024
- out << " className=\" " << ErrorLogger::toxml (scope->className ) << " \" " ;
4025
- if (scope->bodyStart )
4026
- out << " bodyStart=\" " << scope->bodyStart << ' \" ' ;
4027
- if (scope->bodyEnd )
4028
- out << " bodyEnd=\" " << scope->bodyEnd << ' \" ' ;
4029
- if (scope->nestedIn )
4030
- out << " nestedIn=\" " << scope->nestedIn << " \" " ;
4031
- if (scope->function )
4032
- out << " function=\" " << scope->function << " \" " ;
4033
- if (scope->definedType )
4034
- out << " definedType=\" " << scope->definedType << " \" " ;
4020
+ outs += " <scope" ;
4021
+ outs += " id=\" " ;
4022
+ outs += ptr_to_string (&*scope);
4023
+ outs += " \" " ;
4024
+ outs += " type=\" " ;
4025
+ outs += std::to_string (scope->type );
4026
+ outs += " \" " ;
4027
+ if (!scope->className .empty ()) {
4028
+ outs += " className=\" " ;
4029
+ outs += ErrorLogger::toxml (scope->className );
4030
+ outs += " \" " ;
4031
+ }
4032
+ if (scope->bodyStart ) {
4033
+ outs += " bodyStart=\" " ;
4034
+ outs += ptr_to_string (scope->bodyStart );
4035
+ outs += ' \" ' ;
4036
+ }
4037
+ if (scope->bodyEnd ) {
4038
+ outs += " bodyEnd=\" " ;
4039
+ outs += ptr_to_string (scope->bodyEnd );
4040
+ outs += ' \" ' ;
4041
+ }
4042
+ if (scope->nestedIn ) {
4043
+ outs += " nestedIn=\" " ;
4044
+ outs += ptr_to_string (scope->nestedIn );
4045
+ outs += " \" " ;
4046
+ }
4047
+ if (scope->function ) {
4048
+ outs += " function=\" " ;
4049
+ outs += ptr_to_string (scope->function );
4050
+ outs += " \" " ;
4051
+ }
4052
+ if (scope->definedType ) {
4053
+ outs += " definedType=\" " ;
4054
+ outs += ptr_to_string (scope->definedType );
4055
+ outs += " \" " ;
4056
+ }
4035
4057
if (scope->functionList .empty () && scope->varlist .empty ())
4036
- out << " />" << std::endl ;
4058
+ outs += " />\n " ;
4037
4059
else {
4038
- out << ' > ' << std::endl ;
4060
+ outs += " > \n " ;
4039
4061
if (!scope->functionList .empty ()) {
4040
- out << " <functionList>" << std::endl ;
4062
+ outs += " <functionList>\n " ;
4041
4063
for (std::list<Function>::const_iterator function = scope->functionList .cbegin (); function != scope->functionList .cend (); ++function) {
4042
- out << " <function id=\" " << &*function
4043
- << " \" token=\" " << function->token
4044
- << " \" tokenDef=\" " << function->tokenDef
4045
- << " \" name=\" " << ErrorLogger::toxml (function->name ()) << ' \" ' ;
4046
- out << " type=\" " << (function->type == Function::eConstructor? " Constructor" :
4047
- function->type == Function::eCopyConstructor ? " CopyConstructor" :
4048
- function->type == Function::eMoveConstructor ? " MoveConstructor" :
4049
- function->type == Function::eOperatorEqual ? " OperatorEqual" :
4050
- function->type == Function::eDestructor ? " Destructor" :
4051
- function->type == Function::eFunction ? " Function" :
4052
- function->type == Function::eLambda ? " Lambda" :
4053
- " Unknown" ) << ' \" ' ;
4064
+ outs += " <function id=\" " ;
4065
+ outs += ptr_to_string (&*function);
4066
+ outs += " \" token=\" " ;
4067
+ outs += ptr_to_string (function->token );
4068
+ outs += " \" tokenDef=\" " ;
4069
+ outs += ptr_to_string (function->tokenDef );
4070
+ outs += " \" name=\" " ;
4071
+ outs += ErrorLogger::toxml (function->name ());
4072
+ outs += ' \" ' ;
4073
+ outs += " type=\" " ;
4074
+ outs += (function->type == Function::eConstructor? " Constructor" :
4075
+ function->type == Function::eCopyConstructor ? " CopyConstructor" :
4076
+ function->type == Function::eMoveConstructor ? " MoveConstructor" :
4077
+ function->type == Function::eOperatorEqual ? " OperatorEqual" :
4078
+ function->type == Function::eDestructor ? " Destructor" :
4079
+ function->type == Function::eFunction ? " Function" :
4080
+ function->type == Function::eLambda ? " Lambda" :
4081
+ " Unknown" );
4082
+ outs += ' \" ' ;
4054
4083
if (function->nestedIn ->definedType ) {
4055
4084
if (function->hasVirtualSpecifier ())
4056
- out << " hasVirtualSpecifier=\" true\" " ;
4085
+ outs += " hasVirtualSpecifier=\" true\" " ;
4057
4086
else if (function->isImplicitlyVirtual ())
4058
- out << " isImplicitlyVirtual=\" true\" " ;
4087
+ outs += " isImplicitlyVirtual=\" true\" " ;
4088
+ }
4089
+ if (function->access == AccessControl::Public || function->access == AccessControl::Protected || function->access == AccessControl::Private) {
4090
+ outs += " access=\" " ;
4091
+ outs += accessControlToString (function->access );
4092
+ outs +=" \" " ;
4059
4093
}
4060
- if (function->access == AccessControl::Public || function->access == AccessControl::Protected || function->access == AccessControl::Private)
4061
- out << " access=\" " << accessControlToString (function->access ) << " \" " ;
4062
4094
if (function->isInlineKeyword ())
4063
- out << " isInlineKeyword=\" true\" " ;
4095
+ outs += " isInlineKeyword=\" true\" " ;
4064
4096
if (function->isStatic ())
4065
- out << " isStatic=\" true\" " ;
4097
+ outs += " isStatic=\" true\" " ;
4066
4098
if (function->isAttributeNoreturn ())
4067
- out << " isAttributeNoreturn=\" true\" " ;
4068
- if (const Function* overriddenFunction = function->getOverriddenFunction ())
4069
- out << " overriddenFunction=\" " << overriddenFunction << " \" " ;
4099
+ outs += " isAttributeNoreturn=\" true\" " ;
4100
+ if (const Function* overriddenFunction = function->getOverriddenFunction ()) {
4101
+ outs += " overriddenFunction=\" " ;
4102
+ outs += ptr_to_string (overriddenFunction);
4103
+ outs += " \" " ;
4104
+ }
4070
4105
if (function->argCount () == 0U )
4071
- out << " />" << std::endl ;
4106
+ outs += " />\n " ;
4072
4107
else {
4073
- out << " >" << std::endl ;
4108
+ outs += " >\n " ;
4074
4109
for (unsigned int argnr = 0 ; argnr < function->argCount (); ++argnr) {
4075
4110
const Variable *arg = function->getArgumentVar (argnr);
4076
- out << " <arg nr=\" " << argnr+1 << " \" variable=\" " << arg << " \" />" << std::endl;
4111
+ outs += " <arg nr=\" " ;
4112
+ outs += std::to_string (argnr+1 );
4113
+ outs += " \" variable=\" " ;
4114
+ outs += ptr_to_string (arg);
4115
+ outs += " \" />\n " ;
4077
4116
variables.insert (arg);
4078
4117
}
4079
- out << " </function>" << std::endl ;
4118
+ outs += " </function>\n " ;
4080
4119
}
4081
4120
}
4082
- out << " </functionList>" << std::endl ;
4121
+ outs += " </functionList>\n " ;
4083
4122
}
4084
4123
if (!scope->varlist .empty ()) {
4085
- out << " <varlist>" << std::endl;
4086
- for (std::list<Variable>::const_iterator var = scope->varlist .cbegin (); var != scope->varlist .cend (); ++var)
4087
- out << " <var id=\" " << &*var << " \" />" << std::endl;
4088
- out << " </varlist>" << std::endl;
4124
+ outs += " <varlist>\n " ;
4125
+ for (std::list<Variable>::const_iterator var = scope->varlist .cbegin (); var != scope->varlist .cend (); ++var) {
4126
+ outs += " <var id=\" " ;
4127
+ outs += ptr_to_string (&*var);
4128
+ outs += " \" />\n " ;
4129
+ }
4130
+ outs += " </varlist>\n " ;
4089
4131
}
4090
- out << " </scope>" << std::endl ;
4132
+ outs += " </scope>\n " ;
4091
4133
}
4092
4134
}
4093
- out << " </scopes>" << std::endl ;
4135
+ outs += " </scopes>\n " ;
4094
4136
4095
4137
if (!typeList.empty ()) {
4096
- out << " <types>\n " ;
4138
+ outs += " <types>\n " ;
4097
4139
for (const Type& type:typeList) {
4098
- out << " <type id=\" " << &type << " \" classScope=\" " << type.classScope << " \" " ;
4140
+ outs += " <type id=\" " ;
4141
+ outs += ptr_to_string (&type);
4142
+ outs += " \" classScope=\" " ;
4143
+ outs += ptr_to_string (type.classScope );
4144
+ outs += " \" " ;
4099
4145
if (type.derivedFrom .empty ()) {
4100
- out << " />\n " ;
4146
+ outs += " />\n " ;
4101
4147
continue ;
4102
4148
}
4103
- out << " >\n " ;
4149
+ outs += " >\n " ;
4104
4150
for (const Type::BaseInfo& baseInfo: type.derivedFrom ) {
4105
- out << " <derivedFrom"
4106
- << " access=\" " << accessControlToString (baseInfo.access ) << " \" "
4107
- << " type=\" " << baseInfo.type << " \" "
4108
- << " isVirtual=\" " << (baseInfo.isVirtual ? " true" : " false" ) << " \" "
4109
- << " nameTok=\" " << baseInfo.nameTok << " \" "
4110
- << " />\n " ;
4111
- }
4112
- out << " </type>\n " ;
4113
- }
4114
- out << " </types>\n " ;
4151
+ outs += " <derivedFrom" ;
4152
+ outs += " access=\" " ;
4153
+ outs += accessControlToString (baseInfo.access );
4154
+ outs += " \" " ;
4155
+ outs += " type=\" " ;
4156
+ outs += ptr_to_string (baseInfo.type );
4157
+ outs += " \" " ;
4158
+ outs += " isVirtual=\" " ;
4159
+ outs += bool_to_string (baseInfo.isVirtual );
4160
+ outs += " \" " ;
4161
+ outs += " nameTok=\" " ;
4162
+ outs += ptr_to_string (baseInfo.nameTok );
4163
+ outs += " \" " ;
4164
+ outs += " />\n " ;
4165
+ }
4166
+ outs += " </type>\n " ;
4167
+ }
4168
+ outs += " </types>\n " ;
4115
4169
}
4116
4170
4117
4171
// Variables..
4118
4172
for (const Variable *var : mVariableList )
4119
4173
variables.insert (var);
4120
- out << " <variables>" << std::endl ;
4174
+ outs += " <variables>\n " ;
4121
4175
for (const Variable *var : variables) {
4122
4176
if (!var)
4123
4177
continue ;
4124
- out << " <var id=\" " << var << ' \" ' ;
4125
- out << " nameToken=\" " << var->nameToken () << ' \" ' ;
4126
- out << " typeStartToken=\" " << var->typeStartToken () << ' \" ' ;
4127
- out << " typeEndToken=\" " << var->typeEndToken () << ' \" ' ;
4128
- out << " access=\" " << accessControlToString (var->mAccess ) << ' \" ' ;
4129
- out << " scope=\" " << var->scope () << ' \" ' ;
4130
- if (var->valueType ())
4131
- out << " constness=\" " << var->valueType ()->constness << ' \" ' ;
4132
- out << " isArray=\" " << var->isArray () << ' \" ' ;
4133
- out << " isClass=\" " << var->isClass () << ' \" ' ;
4134
- out << " isConst=\" " << var->isConst () << ' \" ' ;
4135
- out << " isExtern=\" " << var->isExtern () << ' \" ' ;
4136
- out << " isPointer=\" " << var->isPointer () << ' \" ' ;
4137
- out << " isReference=\" " << var->isReference () << ' \" ' ;
4138
- out << " isStatic=\" " << var->isStatic () << ' \" ' ;
4139
- out << " isVolatile=\" " << var->isVolatile () << ' \" ' ;
4140
- out << " />" << std::endl;
4141
- }
4142
- out << " </variables>" << std::endl;
4143
- out << std::resetiosflags (std::ios::boolalpha);
4178
+ outs += " <var id=\" " ;
4179
+ outs += ptr_to_string (var);
4180
+ outs += ' \" ' ;
4181
+ outs += " nameToken=\" " ;
4182
+ outs += ptr_to_string (var->nameToken ());
4183
+ outs += ' \" ' ;
4184
+ outs += " typeStartToken=\" " ;
4185
+ outs += ptr_to_string (var->typeStartToken ());
4186
+ outs += ' \" ' ;
4187
+ outs += " typeEndToken=\" " ;
4188
+ outs += ptr_to_string (var->typeEndToken ());
4189
+ outs += ' \" ' ;
4190
+ outs += " access=\" " ;
4191
+ outs += accessControlToString (var->mAccess );
4192
+ outs += ' \" ' ;
4193
+ outs += " scope=\" " ;
4194
+ outs += ptr_to_string (var->scope ());
4195
+ outs += ' \" ' ;
4196
+ if (var->valueType ()) {
4197
+ outs += " constness=\" " ;
4198
+ outs += std::to_string (var->valueType ()->constness );
4199
+ outs += ' \" ' ;
4200
+ }
4201
+ outs += " isArray=\" " ;
4202
+ outs += bool_to_string (var->isArray ());
4203
+ outs += ' \" ' ;
4204
+ outs += " isClass=\" " ;
4205
+ outs += bool_to_string (var->isClass ());
4206
+ outs += ' \" ' ;
4207
+ outs += " isConst=\" " ;
4208
+ outs += bool_to_string (var->isConst ());
4209
+ outs += ' \" ' ;
4210
+ outs += " isExtern=\" " ;
4211
+ outs += bool_to_string (var->isExtern ());
4212
+ outs += ' \" ' ;
4213
+ outs += " isPointer=\" " ;
4214
+ outs += bool_to_string (var->isPointer ());
4215
+ outs += ' \" ' ;
4216
+ outs += " isReference=\" " ;
4217
+ outs += bool_to_string (var->isReference ());
4218
+ outs += ' \" ' ;
4219
+ outs += " isStatic=\" " ;
4220
+ outs += bool_to_string (var->isStatic ());
4221
+ outs += ' \" ' ;
4222
+ outs += " isVolatile=\" " ;
4223
+ outs += bool_to_string (var->isVolatile ());
4224
+ outs += ' \" ' ;
4225
+ outs += " />\n " ;
4226
+ }
4227
+ outs += " </variables>\n " ;
4228
+
4229
+ out << outs;
4144
4230
}
4145
4231
4146
4232
// ---------------------------------------------------------------------------
0 commit comments