mummy  1.0.3
MummyUtilities.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 // MummyUtilities.h
3 //
4 // Author(s) : David Cole
5 //
6 // Copyright (C) 2006-2007 Kitware, Inc.
7 //----------------------------------------------------------------------------
8 
9 #ifndef MummyUtilities_h
10 #define MummyUtilities_h
11 
12 // Suppress nearly meaningless warnings:
13 //
14 #ifdef _MSC_VER
15 #pragma warning(disable:4127)
16  // 4127 is suppressed because it warns on every single stl container iteration
17  // loop that the "conditional expression is constant"...
18 #endif
19 
20 #include "cableContext.h"
21 #include "cxxFundamentalType.h"
22 
23 #include "gxsys/ios/iosfwd"
24 #include "gxsys/stl/string"
25 
26 namespace cable
27 {
28  class Class;
29  class Constructor;
30  class FunctionType;
31  class Type;
32 }
33 
34 void Trace(const char *s);
35 void Emit(gxsys_ios::ostream &os, const char *s);
36 void EmitInt(gxsys_ios::ostream &os, const int i);
37 void EmitUint(gxsys_ios::ostream &os, const unsigned int i);
38 void EmitIndent(gxsys_ios::ostream &os, const unsigned int n = 1);
39 void EmitFile(gxsys_ios::ostream &os, const char *filename);
40 void WriteToFile(const char *filename, const char *s);
41 bool IsChar(const cable::Type *t);
42 bool IsFundamental(const cable::Type *t, cxx::FundamentalType::Id tid);
43 bool IsObject(const cable::Type *t);
44 bool IsVoid(const cable::Type *t);
45 bool HasMapToType(const cable::Type *t);
46 gxsys_stl::string GetMapToType(const cable::Type *t);
47 gxsys_stl::string GetStringMethod(const cable::Type *t);
48 bool IsCharPointer(const cable::Type *t);
49 bool IsCharPointerPointer(const cable::Type *t);
50 bool IsFundamentalPointer(const cable::Type *t, cxx::FundamentalType::Id tid);
51 bool IsFundamentalPointerPointer(const cable::Type *t, cxx::FundamentalType::Id tid);
52 bool IsObjectPointer(const cable::Type *t);
53 bool IsObjectPointerReference(const cable::Type *t);
54 bool IsVoidPointer(const cable::Type *t);
55 const char *GetAccessString(cable::Context::Access access);
56 const cable::Class *GetParentClass(const cable::Class *c);
57 bool ClassIsA(const cable::Class *c, const gxsys_stl::string& parent);
58 bool ValidateBaseClasses(const cable::Class *c);
59 gxsys_stl::string GetSimpleName(const cable::Named *n);
60 gxsys_stl::string GetFullyQualifiedName(const cable::Named *n, const char *sep);
61 gxsys_stl::string GetFullyQualifiedNameForCPlusPlus(const cable::Named *n);
62 gxsys_stl::string GetFullyQualifiedNameForCSharp(const cable::Named *n);
63 gxsys_stl::string GetFullyQualifiedCPlusPlusTypeIdName(const cable::Named *n);
64 bool EquivalentTypedefNameExists(const cable::Class* c, const cable::FunctionType *target, gxsys_stl::string& s);
65 bool HasAttribute(const cable::SourceObject *o, const char *attr);
66 bool IsUtilityClass(const cable::Class *c);
67 gxsys_stl::string ExtractAttribute(const gxsys_stl::string& atts, const gxsys_stl::string& attBase);
68 gxsys_stl::string ExtractAttribute(const cable::SourceObject *o, const gxsys_stl::string& attBase);
69 gxsys_stl::string ExtractArraySize(const gxsys_stl::string& atts);
70 gxsys_stl::string ExtractImplementsInterface(const gxsys_stl::string& atts);
71 gxsys_stl::string ExtractMapToType(const cable::SourceObject *o);
72 gxsys_stl::string ExtractStringMethod(const cable::SourceObject *o);
73 gxsys_stl::string GetMappedTypeName(const cable::Class *c, bool fullyQualified);
74 gxsys_stl::string GetWrappedClassName(const cable::Class *c);
75 gxsys_stl::string GetWrappedClassNameFullyQualified(const cable::Class *c);
76 void SuppressMsg(const int n);
77 bool ShouldLogMsg(const int n);
78 void LogMsg(const gxsys_stl::string& file, const unsigned long line, const gxsys_stl::string& label, const int n);
79 int GetErrorCount();
80 int GetFirstErrorValue();
81 int GetNthErrorValue(int n);
83 const cable::Constructor* FindNonAbstractPublicDefaultConstructor(const cable::Class *c);
84 gxsys_stl::string GetCPlusPlusZeroInitializerExpression(const cable::Type *t);
85 gxsys_stl::string GetCsharpZeroInitializerExpression(const cable::Type *t);
86 bool BlockContains(const gxsys_stl::vector<gxsys_stl::string>& block, const char *value);
87 bool ShouldEmitComment(const char *comment);
88 gxsys_stl::string EncodeStringForXml(const char *s);
89 void EmitDocumentationBlock(gxsys_ios::ostream &os, const gxsys_stl::vector<gxsys_stl::string>& block, const unsigned int indent, bool isClassDoc = false);
90 gxsys_stl::string ExtractDerivedName(const char *s, const cable::Named *n, bool verbose);
91 
92 #endif
void LogMsg(const gxsys_stl::string &file, const unsigned long line, const gxsys_stl::string &label, const int n)
bool IsVoid(const cable::Type *t)
const cable::Class * GetParentClass(const cable::Class *c)
bool IsCharPointer(const cable::Type *t)
bool ClassIsA(const cable::Class *c, const gxsys_stl::string &parent)
bool IsUtilityClass(const cable::Class *c)
bool HasMapToType(const cable::Type *t)
gxsys_stl::string ExtractAttribute(const gxsys_stl::string &atts, const gxsys_stl::string &attBase)
gxsys_stl::string ExtractArraySize(const gxsys_stl::string &atts)
int GetFirstErrorValue()
gxsys_stl::string GetFullyQualifiedNameForCSharp(const cable::Named *n)
gxsys_stl::string GetStringMethod(const cable::Type *t)
bool ValidateBaseClasses(const cable::Class *c)
gxsys_stl::string GetFullyQualifiedCPlusPlusTypeIdName(const cable::Named *n)
gxsys_stl::string GetCPlusPlusZeroInitializerExpression(const cable::Type *t)
bool IsFundamentalPointerPointer(const cable::Type *t, cxx::FundamentalType::Id tid)
void WriteToFile(const char *filename, const char *s)
void EmitInt(gxsys_ios::ostream &os, const int i)
gxsys_stl::string GetFullyQualifiedNameForCPlusPlus(const cable::Named *n)
void EmitDocumentationBlock(gxsys_ios::ostream &os, const gxsys_stl::vector< gxsys_stl::string > &block, const unsigned int indent, bool isClassDoc=false)
bool IsObject(const cable::Type *t)
bool IsCharPointerPointer(const cable::Type *t)
int GetErrorCount()
bool IsChar(const cable::Type *t)
gxsys_stl::string GetSimpleName(const cable::Named *n)
bool IsObjectPointer(const cable::Type *t)
void EmitUint(gxsys_ios::ostream &os, const unsigned int i)
bool HasAttribute(const cable::SourceObject *o, const char *attr)
const cable::Constructor * FindNonAbstractPublicDefaultConstructor(const cable::Class *c)
bool IsVoidPointer(const cable::Type *t)
gxsys_stl::string ExtractMapToType(const cable::SourceObject *o)
gxsys_stl::string GetMapToType(const cable::Type *t)
gxsys_stl::string ExtractImplementsInterface(const gxsys_stl::string &atts)
bool IsObjectPointerReference(const cable::Type *t)
void EmitIndent(gxsys_ios::ostream &os, const unsigned int n=1)
void SuppressMsg(const int n)
bool ShouldEmitComment(const char *comment)
gxsys_stl::string ExtractDerivedName(const char *s, const cable::Named *n, bool verbose)
gxsys_stl::string GetCsharpZeroInitializerExpression(const cable::Type *t)
bool IsFundamentalPointer(const cable::Type *t, cxx::FundamentalType::Id tid)
bool ShouldLogMsg(const int n)
bool EquivalentTypedefNameExists(const cable::Class *c, const cable::FunctionType *target, gxsys_stl::string &s)
gxsys_stl::string ExtractStringMethod(const cable::SourceObject *o)
gxsys_stl::string EncodeStringForXml(const char *s)
int GetMostRecentErrorValue()
bool BlockContains(const gxsys_stl::vector< gxsys_stl::string > &block, const char *value)
const char * GetAccessString(cable::Context::Access access)
gxsys_stl::string GetMappedTypeName(const cable::Class *c, bool fullyQualified)
void EmitFile(gxsys_ios::ostream &os, const char *filename)
gxsys_stl::string GetWrappedClassName(const cable::Class *c)
bool IsFundamental(const cable::Type *t, cxx::FundamentalType::Id tid)
gxsys_stl::string GetFullyQualifiedName(const cable::Named *n, const char *sep)
void Trace(const char *s)
void Emit(gxsys_ios::ostream &os, const char *s)
int GetNthErrorValue(int n)
gxsys_stl::string GetWrappedClassNameFullyQualified(const cable::Class *c)