/usr/include/root/Reflex/DictionaryGenerator.h is in libroot-core-dev 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | // @(#)root/reflex:$Id$
// Author: Antti Hahto 06/20/06
// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.
// DictGen, a replacement for genreflex.py
//================================================
//USAGE:
//
// 1. Create a new generator : Dictgen generator
// 2. Set recursive parsing, optional (default:on) : generator.Use_recursive(true/false)
// 3. Set selection file, optional : generator.Use_selection("filename")
// 4. Run, example
// Scope::GlobalScope().Gendict(generator);
// 5. Dump results into file/stdout(if filename left empty) : generator.Dump("filename")
#ifndef Reflex_DictionaryGenerator
#define Reflex_DictionaryGenerator
#include "Reflex/Kernel.h"
#include "Reflex/Type.h"
#include <fstream>
#include <string>
#include <iostream>
#include <vector>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <limits>
#include <ostream>
#include <sstream>
#include <list> // isnewtype2
#include <algorithm> //isnewtype2
#ifdef _WIN32
# pragma warning( push )
# pragma warning( disable : 4251 )
#endif
namespace Reflex {
// forward declarations
class Type;
/*
* @class DictionaryGenerator DictonaryGenerator.h Reflex/DictionaryGenerator.h
* @author Antti Hahto
* @date 20/06/2006
* @ingroup Ref
*/
class RFLX_API DictionaryGenerator {
public:
/* default constructor */
DictionaryGenerator();
/* destructor */
~DictionaryGenerator();
friend std::ostream& operator <<(std::ostream& s,
const DictionaryGenerator& obj);
/**
* Use_recursive set recursive or not
* @param recursive
* @return
*/
bool Use_recursive(bool recursive);
/**
* Use_selection set selection file
* @param filename
* @return
*/
bool Use_selection(const std::string& filename);
/**
* Dump output the results into stream
* @param filename
*/
void Print(const std::string& filename = "");
/**
* AddHeaderFile adds an extra user .h file into dump
* @param filename
*/
void AddHeaderFile(const std::string& filename);
/**
* GetTypeNumber allt types have a unique id-number
* @param mebertype
* @return
*/
std::string GetTypeNumber(const Type& membertype);
/**
* Use_recursive get if recursion set
* @return true if recursion is set
*/
bool Use_recursive();
/**
* AddIntoInstances add Instances -field into output
* @param item
*/
void AddIntoInstances(const std::string& item);
/**
* AddIntoNS add NS field into output
* @param typenumber
* @param membertype
*/
void AddIntoNS(const std::string& typenumber,
const Type& membertype);
/**
* AddIntoShadow add Shadow field into output
* param item
*/
void AddIntoShadow(const std::string& item);
/**
* AddIntoFree add Free field into output
* @param item
*/
void AddIntoFree(const std::string& item);
/**
* AddIntoClasses add Classes field into output
* @param item
*/
void AddIntoClasses(const std::string& item);
/**
* fMethodCountermethod_Xn, after Stub Functions for the class
*/
double fMethodCounter;
/**
* fStr_namespaces
*/
std::ostringstream fStr_namespaces;
/**
* GetParams
* @param membertype
*/
std::string GetParams(const Type& membertype);
/**
* IsNewType already introduced type?
* @param searchtype
* @return
*/
bool IsNewType(const Type& searchtype);
/**
* Replace_colon
* @param scoped_name
* @return
*/
std::string Replace_colon(std::string scoped_name);
/**
* fSelections
*/
std::vector<std::string> fSelections; // for explicitly choosing classes to include into generation
/**
* fPattern_selections
*/
std::vector<std::string> fPattern_selections;
bool IsNewType2(const Type& searchtype); // testing; work-in-progress
private:
/**
* GetSubScopes one scope can include multiple subscopes
* @param allscopes
*/
void GetSubScopes(Scope_Iterator allscopes);
/**
* GetMembers and subscope can include members
*/
void GetMembers(Scope_Iterator subsco);
/**
* fTypes store used types
*/
std::vector<Reflex::Type> fTypes;
/**
* fStr_header
*/
std::ostringstream fStr_header;
/**
* fStr_shadow
*/
std::ostringstream fStr_shadow;
/**
* fStr_shadow2 member predefinations for shadow
*/
std::ostringstream fStr_shadow2;
/**
* fStr_classes
*/
std::ostringstream fStr_classes;
/**
* fStr_classes_method for class part, method_xn
*/
std::ostringstream fStr_classes_method;
/**
* fStr_frees
*/
std::ostringstream fStr_frees;
/**
* fStr_instances
*/
std::ostringstream fStr_instances;
/**
* fStr_instances2 instances unload() -part
*/
std::ostringstream fStr_instances2;
/**
* fSelect_recursive if set true, recursive go throught all the scopes
*/
bool fSelect_recursive;
/*
// FIND2 START testing
struct mydata
{
Reflex::Type itemnum;
Reflex::Type value;
};
struct MatchItemNum
{
Reflex::Type itemnum;
MatchItemNum(Reflex::Type num) : itemnum(num)
{
}
bool operator()(const mydata &data) const
{
//return (data.itemnum == itemnum);
return (data.itemnum.IsEquivalentTo(itemnum));
}
};
std::list<mydata> types2;
// FIND2 END
*/
}; // class DictionaryGenerator
/** stream operator */
std::ostream& operator <<(std::ostream& s,
const DictionaryGenerator& obj);
} // namespace Reflex
//-------------------------------------------------------------------------------
inline void
Reflex::DictionaryGenerator::AddHeaderFile(const std::string& filename) {
//-------------------------------------------------------------------------------
// Adds an extra user .h -file into dump
fStr_header << "#include \"" << filename << "\"\n";
}
//-------------------------------------------------------------------------------
inline void
Reflex::DictionaryGenerator::AddIntoInstances(const std::string& item) {
//-------------------------------------------------------------------------------
// The last field of the generated file
fStr_instances << item;
}
//-------------------------------------------------------------------------------
inline void
Reflex::DictionaryGenerator::AddIntoShadow(const std::string& item) {
//-------------------------------------------------------------------------------
// Shadow field of the generated file
fStr_shadow << item;
}
//-------------------------------------------------------------------------------
inline void
Reflex::DictionaryGenerator::AddIntoFree(const std::string& item) {
//-------------------------------------------------------------------------------
// Free field generation
fStr_frees << item;
}
//-------------------------------------------------------------------------------
inline void
Reflex::DictionaryGenerator::AddIntoClasses(const std::string& item) {
//-------------------------------------------------------------------------------
// Classes field generation
fStr_classes << item;
}
//-------------------------------------------------------------------------------
inline Reflex::DictionaryGenerator::DictionaryGenerator()
//-------------------------------------------------------------------------------
: fMethodCounter(0),
fSelect_recursive(true) {
fTypes.clear(); // storage of used types
}
//-------------------------------------------------------------------------------
inline Reflex::DictionaryGenerator::~DictionaryGenerator() {
//-------------------------------------------------------------------------------
}
#ifdef _WIN32
# pragma warning( pop )
#endif
#endif // Reflex_DictionaryGenerator
|