diff options
author | Marc Laukien <marc@zeroc.com> | 2001-07-19 22:14:34 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-07-19 22:14:34 +0000 |
commit | 032f424df7f4dec8ab18cc21f865bddad38c4f50 (patch) | |
tree | 2f6e777d7cd3ee28df8e02e8dc23118110fba70d /cpp/src/slice2docbook/GenUtil.cpp | |
parent | error checking (diff) | |
download | ice-032f424df7f4dec8ab18cc21f865bddad38c4f50.tar.bz2 ice-032f424df7f4dec8ab18cc21f865bddad38c4f50.tar.xz ice-032f424df7f4dec8ab18cc21f865bddad38c4f50.zip |
started with slice2docbook; removed slice2html
Diffstat (limited to 'cpp/src/slice2docbook/GenUtil.cpp')
-rw-r--r-- | cpp/src/slice2docbook/GenUtil.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/cpp/src/slice2docbook/GenUtil.cpp b/cpp/src/slice2docbook/GenUtil.cpp new file mode 100644 index 00000000000..fa2f0de0045 --- /dev/null +++ b/cpp/src/slice2docbook/GenUtil.cpp @@ -0,0 +1,77 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <GenUtil.h> + +using namespace std; +using namespace Slice; + +string +Slice::typeToString(const Type_ptr& type) +{ + static const char* builtinTable[] = + { + "byte", + "bool", + "short", + "int", + "long", + "float", + "double", + "string", + "wstring", + "Object", + "Object*", + "LocalObject" + }; + + Builtin_ptr builtin = Builtin_ptr::dynamicCast(type); + if(builtin) + return builtinTable[builtin -> kind()]; + + ClassDecl_ptr cl = ClassDecl_ptr::dynamicCast(type); + if(cl) + return cl -> scoped().substr(2); + + Proxy_ptr proxy = Proxy_ptr::dynamicCast(type); + if(proxy) + return proxy -> _class() -> scoped().substr(2) + "*"; + + Contained_ptr contained = Contained_ptr::dynamicCast(type); + if(contained) + return contained -> scoped().substr(2); + + return "???"; +} + + +struct ToFile +{ + char operator()(char c) + { + if(c == ':') + return '_'; + else + return c; + } +}; + +string +Slice::scopedToFile(const string& scoped) +{ + string result; + if(scoped[0] == ':') + result = scoped.substr(2); + else + result = scoped; + transform(result.begin(), result.end(), result.begin(), ToFile()); + result += ".sgml"; + return result; +} |