Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob/include (Common.hpp): msg#00118

db.carob.cvs

Subject: CVS update of carob/include (Common.hpp)

Date: Wednesday, March 22, 2006 @ 18:26:06
Author: marc
Path: /cvsroot/carob/carob/include

Modified: Common.hpp (1.39 -> 1.40)

Implemented { "DEBUG" | "FATAL" | ... } string to enum LogLevel converter


------------+
Common.hpp | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+)


Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.39 carob/include/Common.hpp:1.40
--- carob/include/Common.hpp:1.39 Wed Mar 22 15:04:51 2006
+++ carob/include/Common.hpp Wed Mar 22 18:26:06 2006
@@ -54,6 +54,30 @@
LOG_LEVEL_OFF
};

+class StringLogLevel : public std::string
+{
+public:
+ // we have nothing more than the derived std::string
+ StringLogLevel(const char * s)
+ : std::string(s)
+ { } ;
+
+ // converter from std::string to the enum
+ operator LogLevel() const
+ throw (std::string) // error message
+ {
+ if (0 == compare("DEBUG")) return LOG_LEVEL_DEBUG;
+ if (0 == compare("INFO")) return LOG_LEVEL_INFO;
+ if (0 == compare("WARN")) return LOG_LEVEL_WARN;
+ if (0 == compare("ERROR")) return LOG_LEVEL_ERROR;
+ if (0 == compare("FATAL")) return LOG_LEVEL_FATAL;
+ if (0 == compare("OFF")) return LOG_LEVEL_OFF;
+
+ throw (*this + " is an unknown LogLevel");
+ }
+};
+
+
// Line separator (EOL)
//TODO: get this at runtime => ???
const wchar_t LINE_SEPARATOR[] =
@@ -164,3 +188,13 @@

} //namespace CarobNS
#endif //_COMMON_H_
+
+
+/*
+ * Local Variables:
+ * c-file-style: "bsd"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * End:
+ */
+


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo