mummy
1.0.2
|
00001 //---------------------------------------------------------------------------- 00002 // MummyUtilities.h 00003 // 00004 // Author(s) : David Cole 00005 // 00006 // Copyright (C) 2006-2007 Kitware, Inc. 00007 //---------------------------------------------------------------------------- 00008 00009 #ifndef MummyUtilities_h 00010 #define MummyUtilities_h 00011 00012 // Suppress nearly meaningless warnings: 00013 // 00014 #ifdef _MSC_VER 00015 #pragma warning(disable:4127) 00016 // 4127 is suppressed because it warns on every single stl container iteration 00017 // loop that the "conditional expression is constant"... 00018 #endif 00019 00020 #include "cableContext.h" 00021 #include "cxxFundamentalType.h" 00022 00023 #include "gxsys/ios/iosfwd" 00024 #include "gxsys/stl/string" 00025 00026 namespace cable 00027 { 00028 class Class; 00029 class Constructor; 00030 class FunctionType; 00031 class Type; 00032 } 00033 00034 void Trace(const char *s); 00035 void Emit(gxsys_ios::ostream &os, const char *s); 00036 void EmitInt(gxsys_ios::ostream &os, const int i); 00037 void EmitUint(gxsys_ios::ostream &os, const unsigned int i); 00038 void EmitIndent(gxsys_ios::ostream &os, const unsigned int n = 1); 00039 void EmitFile(gxsys_ios::ostream &os, const char *filename); 00040 void WriteToFile(const char *filename, const char *s); 00041 bool IsChar(const cable::Type *t); 00042 bool IsFundamental(const cable::Type *t, cxx::FundamentalType::Id tid); 00043 bool IsObject(const cable::Type *t); 00044 bool IsVoid(const cable::Type *t); 00045 bool HasMapToType(const cable::Type *t); 00046 gxsys_stl::string GetMapToType(const cable::Type *t); 00047 gxsys_stl::string GetStringMethod(const cable::Type *t); 00048 bool IsCharPointer(const cable::Type *t); 00049 bool IsCharPointerPointer(const cable::Type *t); 00050 bool IsFundamentalPointer(const cable::Type *t, cxx::FundamentalType::Id tid); 00051 bool IsFundamentalPointerPointer(const cable::Type *t, cxx::FundamentalType::Id tid); 00052 bool IsObjectPointer(const cable::Type *t); 00053 bool IsObjectPointerReference(const cable::Type *t); 00054 bool IsVoidPointer(const cable::Type *t); 00055 const char *GetAccessString(cable::Context::Access access); 00056 const cable::Class *GetParentClass(const cable::Class *c); 00057 bool ClassIsA(const cable::Class *c, const gxsys_stl::string& parent); 00058 bool ValidateBaseClasses(const cable::Class *c); 00059 gxsys_stl::string GetSimpleName(const cable::Named *n); 00060 gxsys_stl::string GetFullyQualifiedName(const cable::Named *n, const char *sep); 00061 gxsys_stl::string GetFullyQualifiedNameForCPlusPlus(const cable::Named *n); 00062 gxsys_stl::string GetFullyQualifiedNameForCSharp(const cable::Named *n); 00063 gxsys_stl::string GetFullyQualifiedCPlusPlusTypeIdName(const cable::Named *n); 00064 bool EquivalentTypedefNameExists(const cable::Class* c, const cable::FunctionType *target, gxsys_stl::string& s); 00065 bool HasAttribute(const cable::SourceObject *o, const char *attr); 00066 bool IsUtilityClass(const cable::Class *c); 00067 gxsys_stl::string ExtractAttribute(const gxsys_stl::string& atts, const gxsys_stl::string& attBase); 00068 gxsys_stl::string ExtractAttribute(const cable::SourceObject *o, const gxsys_stl::string& attBase); 00069 gxsys_stl::string ExtractArraySize(const gxsys_stl::string& atts); 00070 gxsys_stl::string ExtractImplementsInterface(const gxsys_stl::string& atts); 00071 gxsys_stl::string ExtractMapToType(const cable::SourceObject *o); 00072 gxsys_stl::string ExtractStringMethod(const cable::SourceObject *o); 00073 gxsys_stl::string GetMappedTypeName(const cable::Class *c, bool fullyQualified); 00074 gxsys_stl::string GetWrappedClassName(const cable::Class *c); 00075 gxsys_stl::string GetWrappedClassNameFullyQualified(const cable::Class *c); 00076 void SuppressMsg(const int n); 00077 bool ShouldLogMsg(const int n); 00078 void LogMsg(const gxsys_stl::string& file, const unsigned long line, const gxsys_stl::string& label, const int n); 00079 int GetErrorCount(); 00080 int GetFirstErrorValue(); 00081 int GetNthErrorValue(int n); 00082 int GetMostRecentErrorValue(); 00083 const cable::Constructor* FindNonAbstractPublicDefaultConstructor(const cable::Class *c); 00084 gxsys_stl::string GetCPlusPlusZeroInitializerExpression(const cable::Type *t); 00085 gxsys_stl::string GetCsharpZeroInitializerExpression(const cable::Type *t); 00086 bool BlockContains(const gxsys_stl::vector<gxsys_stl::string>& block, const char *value); 00087 bool ShouldEmitComment(const char *comment); 00088 gxsys_stl::string EncodeStringForXml(const char *s); 00089 void EmitDocumentationBlock(gxsys_ios::ostream &os, const gxsys_stl::vector<gxsys_stl::string>& block, const unsigned int indent, bool isClassDoc = false); 00090 gxsys_stl::string ExtractDerivedName(const char *s, const cable::Named *n, bool verbose); 00091 00092 #endif