Go to the documentation of this file.00001 #ifndef FWCore_ParameterSet_DocFormatHelper_h
00002 #define FWCore_ParameterSet_DocFormatHelper_h
00003
00004
00005
00006
00007
00008 #include <string>
00009 #include <iosfwd>
00010
00011 namespace edm {
00012
00013 class ParameterDescriptionNode;
00014
00015 class DocFormatHelper {
00016
00017 public:
00018
00019 enum DescriptionParent {
00020 TOP,
00021 OR,
00022 XOR,
00023 AND,
00024 OTHER
00025 };
00026
00027 DocFormatHelper() :
00028 brief_(false),
00029 lineWidth_(80),
00030 indentation_(4),
00031 startColumn2_(24U),
00032 section_(),
00033 pass_(0),
00034 column1_(0),
00035 column2_(0),
00036 column3_(0),
00037 counter_(0),
00038 parent_(OTHER)
00039 { }
00040
00041 void init();
00042
00043 bool brief() const { return brief_; }
00044 size_t lineWidth() const { return lineWidth_; }
00045 int indentation() const { return indentation_; }
00046 int startColumn2() const { return startColumn2_; }
00047
00048 void setBrief(bool value) { brief_ = value; }
00049 void setLineWidth(size_t value) { lineWidth_ = value; }
00050 void setIndentation(int value) { indentation_ = value; }
00051
00052 std::string const& section() const { return section_; }
00053 void setSection(std::string const& value) { section_ = value; }
00054
00055 int pass() const { return pass_; }
00056 void setPass(int value) { pass_ = value; }
00057
00058 size_t column1() const { return column1_; }
00059 size_t column2() const { return column2_; }
00060 size_t column3() const { return column3_; }
00061
00062 void setAtLeast1(size_t width) { if (width > column1_) column1_ = width; }
00063 void setAtLeast2(size_t width) { if (width > column2_) column2_ = width; }
00064 void setAtLeast3(size_t width) { if (width > column3_) column3_ = width; }
00065
00066 int counter() const { return counter_; }
00067 void setCounter(int value) { counter_ = value; }
00068 void incrementCounter() { ++counter_; }
00069 void decrementCounter() { --counter_; }
00070
00071 DescriptionParent parent() const { return parent_; }
00072 void setParent(DescriptionParent value) { parent_ = value; }
00073
00074 size_t commentWidth() const;
00075
00076 static void wrapAndPrintText(std::ostream & os,
00077 std::string const& text,
00078 size_t indent,
00079 size_t suggestedWidth);
00080
00081 void indent(std::ostream & os) const;
00082 void indent2(std::ostream & os) const;
00083
00084 static int offsetModuleLabel() { return 2; }
00085 static int offsetTopLevelPSet() { return 2; }
00086 static int offsetSectionContent() { return 4; }
00087
00088 private:
00089
00090 bool brief_;
00091 size_t lineWidth_;
00092 int indentation_;
00093 size_t startColumn2_;
00094
00095 std::string section_;
00096
00097 int pass_;
00098
00099 size_t column1_;
00100 size_t column2_;
00101 size_t column3_;
00102
00103 int counter_;
00104
00105 DescriptionParent parent_;
00106 };
00107 }
00108 #endif