ResourceDefinition Class Reference

#include <ResourceDefinition.h>

List of all members.

Public Member Functions

 ResourceDefinition (ResourceBundle *bundle, const std::string &key)
virtual ~ResourceDefinition ()
std::string format () const
template<typename t0>
std::string format (const t0 &p0) const
template<typename t0, typename t1>
std::string format (const t0 &p0, const t1 &p1) const
template<typename t0, typename t1, typename t2>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2) const
template<typename t0, typename t1, typename t2, typename t3>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3) const
template<typename t0, typename t1, typename t2, typename t3, typename t4>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4) const
template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4, const t5 &p5) const
template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4, const t5 &p5, const t6 &p6) const
template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4, const t5 &p5, const t6 &p6, const t7 &p7) const
template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7, typename t8>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4, const t5 &p5, const t6 &p6, const t7 &p7, const t8 &p8) const
template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7, typename t8, typename t9>
std::string format (const t0 &p0, const t1 &p1, const t2 &p2, const t3 &p3, const t4 &p4, const t5 &p5, const t6 &p6, const t7 &p7, const t8 &p8, const t9 &p9) const

Protected Member Functions

boost::format prepareFormatter (int numArgs) const

Private Attributes

const std::string _key
ResourceBundle_bundle


Detailed Description

Definition at line 33 of file ResourceDefinition.h.


Constructor & Destructor Documentation

ResourceDefinition::ResourceDefinition ( ResourceBundle bundle,
const std::string &  key 
) [explicit]

ResourceDefinition::~ResourceDefinition (  )  [virtual]

Definition at line 45 of file ResourceDefinition.cpp.

00046 {
00047 }


Member Function Documentation

string ResourceDefinition::format (  )  const

Definition at line 50 of file ResourceDefinition.cpp.

References _bundle, _key, ResourceBundle::getBaseName(), Locale::getDisplayName(), ResourceBundle::getLocale(), ResourceBundle::getMessage(), and ResourceBundle::hasMessage().

Referenced by fennel::FennelResource::bitmapEntryTooLong(), fennel::FennelResource::dataTransferFailed(), fennel::FennelResource::duplicateKeyDetected(), fennel::FennelResource::errorsEncountered(), fennel::FennelResource::executionAborted(), fennel::FennelResource::flatfileDescribeFailed(), fennel::FennelResource::flatfileMappedRequiresLenient(), fennel::FennelResource::flatfileNoHeader(), fennel::FennelResource::flatfileNoMappedColumns(), fennel::FennelResource::incompatibleDataFormat(), fennel::FennelResource::incompleteColumn(), fennel::FennelResource::internalError(), fennel::FennelResource::invalidParam(), fennel::FennelResource::libaioRequired(), fennel::FennelResource::mismatchedRestore(), fennel::FennelResource::noColumnDelimiter(), fennel::FennelResource::noRowDelimiter(), fennel::FennelResource::noRowsReturned(), fennel::FennelResource::openBackupFileFailed(), fennel::FennelResource::outOfBackupSpace(), fennel::FennelResource::outOfSpaceDuringRestore(), fennel::FennelResource::readBackupFileFailed(), fennel::FennelResource::readDataFailed(), fennel::FennelResource::readDataPageFailed(), fennel::FennelResource::rowTextTooLong(), fennel::FennelResource::rowTooLong(), fennel::FennelResource::scalarQueryReturnedMultipleRows(), fennel::FennelResource::scratchMemExhausted(), fennel::FennelResource::sysCallFailed(), fennel::FennelResource::tooFewColumns(), fennel::FennelResource::tooManyColumns(), fennel::FennelResource::uniqueConstraintViolated(), fennel::FennelResource::unsupportedOperation(), fennel::FennelResource::writeBackupFileFailed(), fennel::FennelResource::writeDataPageFailed(), and fennel::FennelResource::writeLogFailed().

00051 {
00052     if (_bundle->hasMessage(_key)) {
00053         return _bundle->getMessage(_key);
00054     } else {
00055         boost::format fmt("%1%.%2%.%3%()");
00056         return (fmt
00057                 % _bundle->getBaseName()
00058                 % _bundle->getLocale().getDisplayName()
00059                 % _key).str();
00060     }
00061 }

template<typename t0>
std::string ResourceDefinition::format ( const t0 &  p0  )  const [inline]

Definition at line 47 of file ResourceDefinition.h.

00048     {
00049         boost::format fmt = prepareFormatter(1);
00050 
00051         return boost::io::str(fmt % p0);
00052     }

template<typename t0, typename t1>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1 
) const [inline]

Definition at line 55 of file ResourceDefinition.h.

00056     {
00057         boost::format fmt = prepareFormatter(2);
00058 
00059         return boost::io::str(fmt % p0 % p1);
00060     }

template<typename t0, typename t1, typename t2>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2 
) const [inline]

Definition at line 63 of file ResourceDefinition.h.

00064     {
00065         boost::format fmt = prepareFormatter(3);
00066 
00067         return boost::io::str(fmt % p0 % p1 % p2);
00068     }

template<typename t0, typename t1, typename t2, typename t3>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3 
) const [inline]

Definition at line 71 of file ResourceDefinition.h.

00073     {
00074         boost::format fmt = prepareFormatter(4);
00075 
00076         return boost::io::str(fmt % p0 % p1 % p2 % p3);
00077     }

template<typename t0, typename t1, typename t2, typename t3, typename t4>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4 
) const [inline]

Definition at line 80 of file ResourceDefinition.h.

00083     {
00084         boost::format fmt = prepareFormatter(5);
00085 
00086         return boost::io::str(fmt % p0 % p1 % p2 % p3 % p4);
00087     }

template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4,
const t5 &  p5 
) const [inline]

Definition at line 91 of file ResourceDefinition.h.

00094     {
00095         boost::format fmt = prepareFormatter(6);
00096 
00097         return boost::io::str(fmt % p0 % p1 % p2 % p3 % p4 % p5);
00098     }

template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4,
const t5 &  p5,
const t6 &  p6 
) const [inline]

Definition at line 102 of file ResourceDefinition.h.

00105     {
00106         boost::format fmt = prepareFormatter(7);
00107 
00108         return boost::io::str(fmt % p0 % p1 % p2 % p3 % p4 % p5 % p6);
00109     }

template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4,
const t5 &  p5,
const t6 &  p6,
const t7 &  p7 
) const [inline]

Definition at line 113 of file ResourceDefinition.h.

00116     {
00117         boost::format fmt = prepareFormatter(8);
00118 
00119         return boost::io::str(fmt % p0 % p1 % p2 % p3 % p4 % p5 % p6 % p7);
00120     }

template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7, typename t8>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4,
const t5 &  p5,
const t6 &  p6,
const t7 &  p7,
const t8 &  p8 
) const [inline]

Definition at line 124 of file ResourceDefinition.h.

00128     {
00129         boost::format fmt = prepareFormatter(9);
00130 
00131         return boost::io::str(fmt % p0 % p1 % p2 % p3 % p4 % p5 % p6 % p7 % p8);
00132     }

template<typename t0, typename t1, typename t2, typename t3, typename t4, typename t5, typename t6, typename t7, typename t8, typename t9>
std::string ResourceDefinition::format ( const t0 &  p0,
const t1 &  p1,
const t2 &  p2,
const t3 &  p3,
const t4 &  p4,
const t5 &  p5,
const t6 &  p6,
const t7 &  p7,
const t8 &  p8,
const t9 &  p9 
) const [inline]

Definition at line 136 of file ResourceDefinition.h.

00140     {
00141         boost::format fmt = prepareFormatter(10);
00142 
00143         return boost::io::str(
00144             fmt % p0 % p1 % p2 % p3 % p4 % p5 % p6 % p7 % p8 % p9);
00145     }

boost::format ResourceDefinition::prepareFormatter ( int  numArgs  )  const [protected]

Definition at line 64 of file ResourceDefinition.cpp.

References _bundle, _key, ResourceBundle::getBaseName(), Locale::getDisplayName(), ResourceBundle::getLocale(), ResourceBundle::getMessage(), and ResourceBundle::hasMessage().

00065 {
00066     if (_bundle->hasMessage(_key)) {
00067         return boost::format(_bundle->getMessage(_key));
00068     } else {
00069         stringstream formatSpecifier;
00070         formatSpecifier << "%1%.%2%.%3%(";
00071         for (int i = 0; i < numArgs; i++) {
00072             if (i != 0) {
00073                 formatSpecifier << ", ";
00074             }
00075             formatSpecifier << "%" << (i + 4) << "%";
00076         }
00077         formatSpecifier << ")";
00078 
00079         boost::format fmt(formatSpecifier.str());
00080 
00081         fmt
00082             % _bundle->getBaseName()
00083             % _bundle->getLocale().getDisplayName()
00084             % _key;
00085 
00086         // formatter is now ready for numArgs parameters
00087         return fmt;
00088     }
00089 }


Member Data Documentation

const std::string ResourceDefinition::_key [private]

Definition at line 35 of file ResourceDefinition.h.

Referenced by format(), and prepareFormatter().

ResourceBundle* ResourceDefinition::_bundle [private]

Definition at line 153 of file ResourceDefinition.h.

Referenced by format(), and prepareFormatter().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:45 2009 for Fennel by  doxygen 1.5.1