Teuchos_TableEntry.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "Teuchos_TableEntry.hpp"
00030
00031 using namespace Teuchos;
00032
00033
00034
00035
00036 std::string TableEntry::toChoppedString(int maxWidth) const
00037 {
00038 return toString().substr(0, maxWidth);
00039 }
00040
00041
00042
00043
00044
00045 DoubleEntry::DoubleEntry(const double& value, int precision)
00046 : TableEntry(), data_(value), precision_(precision)
00047 {}
00048
00049 std::string DoubleEntry::toString() const
00050 {
00051 std::ostringstream toss;
00052 toss << std::setprecision(precision_) << data_;
00053 return toss.str();
00054 }
00055
00056
00057
00058
00059
00060 IntEntry::IntEntry(int value)
00061 : TableEntry(), data_(value)
00062 {}
00063
00064 std::string IntEntry::toString() const
00065 {
00066 std::ostringstream toss;
00067 toss << data_;
00068 return toss.str();
00069 }
00070
00071
00072
00073
00074
00075 StringEntry::StringEntry(std::string value)
00076 : TableEntry(), data_(value)
00077 {}
00078
00079 std::string StringEntry::toString() const
00080 {
00081 return data_;
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 CompoundEntryWithParentheses
00091 ::CompoundEntryWithParentheses(const RCP<TableEntry>& first,
00092 const RCP<TableEntry>& second,
00093 bool spaceBeforeParens)
00094 : TableEntry(),
00095 first_(first),
00096 second_(second),
00097 spaceBeforeParens_(spaceBeforeParens)
00098 {}
00099
00100 std::string CompoundEntryWithParentheses::toString() const
00101 {
00102 std::ostringstream toss;
00103
00104 toss << first_->toString();
00105 if (spaceBeforeParens_) toss << " ";
00106 toss << "(" << second_->toString() << ")";
00107
00108 return toss.str();
00109 }
00110
00111
00112
00113
00114
00115