summaryrefslogtreecommitdiff
path: root/cpp/src/slice2html/Gen.h
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-11-22 08:35:01 +0000
committerMichi Henning <michi@zeroc.com>2006-11-22 08:35:01 +0000
commit9073302574725750291e339e0bb4a60b1475c114 (patch)
treee2cf193e77df8aa481b5f2683802e56b25113787 /cpp/src/slice2html/Gen.h
parentchange .dll extension to .pyd to support Python 2.5 on Windows (diff)
downloadice-9073302574725750291e339e0bb4a60b1475c114.tar.bz2
ice-9073302574725750291e339e0bb4a60b1475c114.tar.xz
ice-9073302574725750291e339e0bb4a60b1475c114.zip
Intermediate check-in for slice2html.
Diffstat (limited to 'cpp/src/slice2html/Gen.h')
-rw-r--r--cpp/src/slice2html/Gen.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/cpp/src/slice2html/Gen.h b/cpp/src/slice2html/Gen.h
new file mode 100644
index 00000000000..8fcb13e28a5
--- /dev/null
+++ b/cpp/src/slice2html/Gen.h
@@ -0,0 +1,162 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+void generate(const UnitPtr&, const ::std::string&, const ::std::string&, const ::std::string&, unsigned);
+
+class GeneratorBase : private ::IceUtil::noncopyable
+{
+public:
+
+ static void setOutputDir(const ::std::string&);
+ static void setHeader(const ::std::string&);
+ static void setFooter(const ::std::string&);
+ static void setIndexCount(const int);
+
+protected:
+
+ GeneratorBase(::IceUtil::XMLOutput&);
+ virtual ~GeneratorBase() = 0;
+
+ void openDoc(const ::std::string&, const std::string&);
+ void openDoc(const ContainedPtr&);
+ void closeDoc();
+
+ void start(const ::std::string&, const ::std::string& = ::std::string());
+ void end();
+
+ ::std::string getComment(const ContainedPtr&, const ContainerPtr&, bool);
+ void printComment(const ContainedPtr&, const ::std::string&);
+ void printMetaData(const ContainedPtr&);
+ void printSummary(const ContainedPtr&, bool);
+
+ ::std::string toString(const SyntaxTreeBasePtr&, const ContainerPtr&, bool = true);
+ ::std::string toString(const ::std::string&, const ContainerPtr&, bool = true);
+
+ ::IceUtil::XMLOutput& _out;
+
+ static unsigned _indexCount;
+
+private:
+
+ StringList getTagged(const ::std::string&, ::std::string&);
+ ::std::string getScopedMinimized(const ContainedPtr&, const ContainerPtr&);
+ ::std::string containedToId(const ContainedPtr&, bool);
+ void openStream(const ::std::string&);
+
+ static StringList toStringList(const ContainedPtr&);
+ static void makeDir(const ::std::string&);
+ static ::std::string readFile(const ::std::string&);
+ static void readFile(const ::std::string&, ::std::string&, ::std::string&);
+
+ static ::std::string _dir;
+ static ::std::string _header1;
+ static ::std::string _header2;
+ static ::std::string _footer;
+};
+
+class IndexGenerator : private GeneratorBase
+{
+public:
+
+ IndexGenerator();
+ ~IndexGenerator();
+ void generate(const ModulePtr&);
+
+private:
+ typedef ::std::pair< ::std::string, ::std::string> StringPair;
+ typedef ::std::vector<StringPair> ModuleDescriptions;
+ ModuleDescriptions _modules;
+ ::IceUtil::XMLOutput _out;
+};
+
+class IndexVisitor : private ::IceUtil::noncopyable, public ParserVisitor
+{
+public:
+
+ IndexVisitor();
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+
+private:
+
+ IndexGenerator _ig;
+};
+
+class ModuleGenerator : private GeneratorBase
+{
+public:
+
+ ModuleGenerator(::IceUtil::XMLOutput&);
+ void generate(const ModulePtr&);
+
+private:
+
+ virtual void visitContainer(const ContainerPtr&);
+
+};
+
+class ExceptionGenerator : private GeneratorBase
+{
+public:
+
+ ExceptionGenerator(::IceUtil::XMLOutput&);
+ void generate(const ExceptionPtr&);
+};
+
+class ClassGenerator : private GeneratorBase
+{
+public:
+
+ ClassGenerator(::IceUtil::XMLOutput&);
+ void generate(const ClassDefPtr&);
+};
+
+class StructGenerator : private GeneratorBase
+{
+public:
+
+ StructGenerator(::IceUtil::XMLOutput&);
+ void generate(const StructPtr&);
+};
+
+class EnumGenerator : private GeneratorBase
+{
+public:
+
+ EnumGenerator(::IceUtil::XMLOutput&);
+ void generate(const EnumPtr&);
+};
+
+class Visitor : private ::IceUtil::noncopyable, public ParserVisitor
+{
+public:
+
+ Visitor();
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitEnum(const EnumPtr&);
+};
+
+}
+
+#endif