summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-02-14 07:02:17 +0000
committerMichi Henning <michi@zeroc.com>2006-02-14 07:02:17 +0000
commit9f9fd99dcf435f9a9fe11941234b7ac2d1d2744a (patch)
treeca70b78314e68852192334df5ec9d490b14b548a /cpp/src
parentChanged order of base-class constructor calls for one-shot constructor. (diff)
downloadice-9f9fd99dcf435f9a9fe11941234b7ac2d1d2744a.tar.bz2
ice-9f9fd99dcf435f9a9fe11941234b7ac2d1d2744a.tar.xz
ice-9f9fd99dcf435f9a9fe11941234b7ac2d1d2744a.zip
Added --sort-fields to slice2docbook.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/Parser.cpp13
-rw-r--r--cpp/src/slice2docbook/Gen.cpp8
-rw-r--r--cpp/src/slice2docbook/Gen.h3
-rw-r--r--cpp/src/slice2docbook/Main.cpp6
4 files changed, 23 insertions, 7 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 3f49a5d84a3..c36bbd38cee 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -1756,13 +1756,22 @@ Slice::Container::sort()
}
void
-Slice::Container::sortContents()
+Slice::Container::sortContents(bool sortFields)
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ContainerPtr container = ContainerPtr::dynamicCast(*p);
if(container)
{
+ if(!sortFields)
+ {
+ if(StructPtr::dynamicCast(container) ||
+ ClassDefPtr::dynamicCast(container) ||
+ ExceptionPtr::dynamicCast(container))
+ {
+ continue;
+ }
+ }
//
// Don't sort operation definitions, otherwise parameters are shown in the
// wrong order in the synopsis.
@@ -1771,7 +1780,7 @@ Slice::Container::sortContents()
{
container->sort();
}
- container->sortContents();
+ container->sortContents(sortFields);
}
}
}
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp
index b0719df9abc..66c3c9c6a40 100644
--- a/cpp/src/slice2docbook/Gen.cpp
+++ b/cpp/src/slice2docbook/Gen.cpp
@@ -15,10 +15,12 @@ using namespace std;
using namespace Slice;
using namespace IceUtil;
-Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool noGlobals, bool chapter, bool noIndex) :
+Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool noGlobals, bool chapter,
+ bool noIndex, bool sortFields) :
_standAlone(standAlone),
_noGlobals(noGlobals),
- _noIndex(noIndex)
+ _noIndex(noIndex),
+ _sortFields(sortFields)
{
if(chapter)
{
@@ -57,7 +59,7 @@ Slice::Gen::generate(const UnitPtr& p)
// I don't want the top-level module to be sorted, therefore no
// p->sort() before or after the p->sortContents().
//
- p->sortContents();
+ p->sortContents(_sortFields);
p->visit(this, false);
}
diff --git a/cpp/src/slice2docbook/Gen.h b/cpp/src/slice2docbook/Gen.h
index 10ddf105deb..26718c07cc8 100644
--- a/cpp/src/slice2docbook/Gen.h
+++ b/cpp/src/slice2docbook/Gen.h
@@ -21,7 +21,7 @@ class Gen : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- Gen(const std::string&, const std::string&, bool, bool, bool, bool);
+ Gen(const std::string&, const std::string&, bool, bool, bool, bool, bool);
virtual ~Gen();
bool operator!() const; // Returns true if there was a constructor error
@@ -61,6 +61,7 @@ private:
bool _noGlobals;
std::string _chapter;
bool _noIndex;
+ bool _sortFields;
};
}
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index e34aaa956b3..898812f0379 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -33,6 +33,7 @@ usage(const char* n)
"--chapter Use \"chapter\" instead of \"section\" as\n"
" top-level element.\n"
"--noindex Suppress generation of index pages.\n"
+ "--sort-fields Sort fields of structures, classes, and exceptions.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
@@ -51,6 +52,7 @@ main(int argc, char* argv[])
bool debug;
bool ice;
bool caseSensitive;
+ bool sortFields;
IceUtil::Options opts;
opts.addOpt("h", "help");
@@ -63,6 +65,7 @@ main(int argc, char* argv[])
opts.addOpt("", "no-globals");
opts.addOpt("", "chapter");
opts.addOpt("", "noindex");
+ opts.addOpt("", "sort-fields");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "case-sensitive");
@@ -118,6 +121,7 @@ main(int argc, char* argv[])
noGlobals = opts.isSet("no-globals");
chapter = opts.isSet("chapter");
noIndex = opts.isSet("noindex");
+ sortFields = opts.isSet("sort-fields");
debug = opts.isSet("d") || opts.isSet("debug");
ice = opts.isSet("ice");
caseSensitive = opts.isSet("case-sensitive");
@@ -190,7 +194,7 @@ main(int argc, char* argv[])
if(status == EXIT_SUCCESS && !preprocess)
{
- Gen gen(argv[0], docbook, standAlone, noGlobals, chapter, noIndex);
+ Gen gen(argv[0], docbook, standAlone, noGlobals, chapter, noIndex, sortFields);
if(!gen)
{
p->destroy();