Added headers
[tpot/pegasus/.git] / src / Pegasus / Common / CIMDateTime.h
index 6c6e7f47f22d9b8672093d7f7f95b5c980ca36de..f3939ef9eac91b3a6d1d42f92d3c3c3528347e2c 100644 (file)
-//%/////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-//==============================================================================
-//
-// Author: Mike Brasher (mbrasher@bmc.com)
-//
-// Modified By:
-//
-//%/////////////////////////////////////////////////////////////////////////////
-
-#ifndef Pegasus_DateTime_h
-#define Pegasus_DateTime_h
-
-#include <Pegasus/Common/Config.h>
-#include <Pegasus/Common/Array.h>
-#include <iostream>
-
-PEGASUS_NAMESPACE_BEGIN
-
-/**
-    The CIMDateTime class represents the CIM datetime data type as a C++ class 
-    CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime 
-    is an intrinsic CIM data type which represents the time as a formated 
-    fixedplength string.
-
-    <PRE>
-    A date has the following form:
-       yyyymmddhhmmss.mmmmmmsutc
-
-    Where
-
-       yyyy = year (0-1999)
-       mm = month (1-12)
-       dd = day (1-31)
-       hh = hour (0-23)
-       mm = minute (0-59)
-       ss = second (0-59)
-       mmmmmm = microseconds.
-       s = '+' or '-' to represent the UTC sign.
-       utc = UTC offset (same as GMT offset).
-
-    An interval has the following form:
-
-       ddddddddhhmmss.mmmmmm:000
-
-    Where
-
-       dddddddd = days
-       hh = hours
-       mm = minutes
-       ss = seconds
-       mmmmmm = microseconds
-    </PRE>
-
-    Note that intervals always end in ":000" (this is how they
-    are distinguished from dates).
-
-    Intervals are really durations since they do not specify a start and
-    end time (as one expects when speaking about an interval). It is
-    better to think of an interval as specifying time elapsed since
-    some event.
-
-    CIMDateTime objects are constructed from C character strings or from
-    other CIMDateTime objects. These character strings must be exactly
-    twenty-five characters and conform to one of the forms idententified
-    above.
-
-    CIMDateTime objects which are not explicitly initialized will be
-    implicitly initialized with the null time interval:
-
-       00000000000000.000000:000
-
-    Instances can be tested for nullness with the isNull() method.
-
-    ATTN: Add inequalities.
-*/
-class PEGASUS_COMMON_LINKAGE CIMDateTime
-{
-public:
-
-    enum { FORMAT_LENGTH = 25 };
-
-    /// CIMDateTime CIMMethod
-    CIMDateTime();
-
-    /** CIMDateTime CIMMethod creates the CIM CIMDateTime from a string 
-       constant representing the CIM DateTime formatted datetime
-       @param str String object containing the CIM DateTime formatted string
-    */
-    CIMDateTime(const char* str);
-
-    /** CIMDateTime CIMMethod - Creates the CIMDateTime instance from another 
-       CIMDateTime object
-       @param x CIMDateTime object to be copied.
-    */
-    CIMDateTime(const CIMDateTime& x);
-
-    /** Destructor. */
-    ~CIMDateTime() { }
-
-    /**  assign CIMDateTime
-    */
-    CIMDateTime& operator=(const CIMDateTime& x);
-
-    /** CIMDateTime isNull method - Tests for an all zero date time
-       <PRE>
-       CIMDateTime dt;
-       dt.clear();
-       assert(dt.isNull());
-       </PRE>
-       @return This method returns true of the contents are
-       "00000000000000.000000:000". Else it returns false
-    */
-    Boolean isNull() const;
-
-    /// method getString
-    const char* getString() const;
-
-    /** method set - Sets the date time. Creates the CIMDateTime instance from 
-       the input string constant which must be
-       in the datetime format.
-
-           <PRE>
-           CIMDateTime dt;
-           dt.set("19991224120000.000000+360");
-           </PRE>
-
-       @return On format error, CIMDateTime set throws the exception 
-       BadDateTimeFormat
-       @exception Throws exception BadDateTimeFormat on format error.
-    */
-    void set(const char* str);
-
-    ///  clear - Clears the datetime class instance.
-    void clear();
-
-    /** CIMDateTime CIMMethod - ATTN: Friend operator Test for CIMDateTime 
-       equality
-    */
-    PEGASUS_COMMON_LINKAGE friend Boolean operator==(
-       const CIMDateTime& x,
-       const CIMDateTime& y);
-
-private:
-
-    Boolean _set(const char* str);
-    char _rep[FORMAT_LENGTH + 1];
-};
-
-PEGASUS_COMMON_LINKAGE Boolean operator==(
-    const CIMDateTime& x, 
-    const CIMDateTime& y);
-
-PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(
-    PEGASUS_STD(ostream)& os, 
-    const CIMDateTime& x);
-
-#define PEGASUS_ARRAY_T CIMDateTime
-# include "ArrayInter.h"
-#undef PEGASUS_ARRAY_T
-
-PEGASUS_NAMESPACE_END
-
-#endif /* Pegasus_DateTime_h */
+//%/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining a copy\r
+// of this software and associated documentation files (the "Software"), to \r
+// deal in the Software without restriction, including without limitation the \r
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or \r
+// sell copies of the Software, and to permit persons to whom the Software is\r
+// furnished to do so, subject to the following conditions:\r
+// \r
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN \r
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED\r
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT\r
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \r
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN \r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+//==============================================================================\r
+//\r
+// Author: Mike Brasher (mbrasher@bmc.com)\r
+//\r
+// Modified By:\r
+//\r
+//%/////////////////////////////////////////////////////////////////////////////\r
+\r
+#ifndef Pegasus_DateTime_h\r
+#define Pegasus_DateTime_h\r
+\r
+#include <Pegasus/Common/Config.h>\r
+#include <Pegasus/Common/Array.h>\r
+#include <iostream>\r
+\r
+PEGASUS_NAMESPACE_BEGIN\r
+\r
+/**\r
+    The CIMDateTime class represents the CIM datetime data type as a C++ class \r
+    CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime \r
+    is an intrinsic CIM data type which represents the time as a formated \r
+    fixedplength string.\r
+\r
+    <PRE>\r
+    A date has the following form:\r
+       yyyymmddhhmmss.mmmmmmsutc\r
+\r
+    Where\r
+\r
+       yyyy = year (0-1999)\r
+       mm = month (1-12)\r
+       dd = day (1-31)\r
+       hh = hour (0-23)\r
+       mm = minute (0-59)\r
+       ss = second (0-59)\r
+       mmmmmm = microseconds.\r
+       s = '+' or '-' to represent the UTC sign.\r
+       utc = UTC offset (same as GMT offset).\r
+\r
+    An interval has the following form:\r
+\r
+       ddddddddhhmmss.mmmmmm:000\r
+\r
+    Where\r
+\r
+       dddddddd = days\r
+       hh = hours\r
+       mm = minutes\r
+       ss = seconds\r
+       mmmmmm = microseconds\r
+    </PRE>\r
+\r
+    Note that intervals always end in ":000" (this is how they\r
+    are distinguished from dates).\r
+\r
+    Intervals are really durations since they do not specify a start and\r
+    end time (as one expects when speaking about an interval). It is\r
+    better to think of an interval as specifying time elapsed since\r
+    some event.\r
+\r
+    CIMDateTime objects are constructed from C character strings or from\r
+    other CIMDateTime objects. These character strings must be exactly\r
+    twenty-five characters and conform to one of the forms idententified\r
+    above.\r
+\r
+    CIMDateTime objects which are not explicitly initialized will be\r
+    implicitly initialized with the null time interval:\r
+\r
+       00000000000000.000000:000\r
+\r
+    Instances can be tested for nullness with the isNull() method.\r
+\r
+    ATTN: Add inequalities.\r
+*/\r
+class PEGASUS_COMMON_LINKAGE CIMDateTime\r
+{\r
+public:\r
+\r
+    enum { FORMAT_LENGTH = 25 };\r
+\r
+    /// CIMDateTime CIMMethod\r
+    CIMDateTime();\r
+\r
+    /** CIMDateTime CIMMethod creates the CIM CIMDateTime from a string \r
+       constant representing the CIM DateTime formatted datetime\r
+       @param str String object containing the CIM DateTime formatted string\r
+    */\r
+    CIMDateTime(const char* str);\r
+\r
+    /** CIMDateTime CIMMethod - Creates the CIMDateTime instance from another \r
+       CIMDateTime object\r
+       @param x CIMDateTime object to be copied.\r
+    */\r
+    CIMDateTime(const CIMDateTime& x);\r
+\r
+    /** Destructor. */\r
+    ~CIMDateTime() { }\r
+\r
+    /**  assign CIMDateTime\r
+    */\r
+    CIMDateTime& operator=(const CIMDateTime& x);\r
+\r
+    /** CIMDateTime isNull method - Tests for an all zero date time\r
+       <PRE>\r
+       CIMDateTime dt;\r
+       dt.clear();\r
+       assert(dt.isNull());\r
+       </PRE>\r
+       @return This method returns true of the contents are\r
+       "00000000000000.000000:000". Else it returns false\r
+    */\r
+    Boolean isNull() const;\r
+\r
+    /// method getString\r
+    const char* getString() const;\r
+\r
+    /** method set - Sets the date time. Creates the CIMDateTime instance from \r
+       the input string constant which must be\r
+       in the datetime format.\r
+\r
+           <PRE>\r
+           CIMDateTime dt;\r
+           dt.set("19991224120000.000000+360");\r
+           </PRE>\r
+\r
+       @return On format error, CIMDateTime set throws the exception \r
+       BadDateTimeFormat\r
+       @exception Throws exception BadDateTimeFormat on format error.\r
+    */\r
+    void set(const char* str);\r
+\r
+    ///  clear - Clears the datetime class instance.\r
+    void clear();\r
+\r
+    /** CIMDateTime CIMMethod - ATTN: Friend operator Test for CIMDateTime \r
+       equality\r
+    */\r
+    PEGASUS_COMMON_LINKAGE friend Boolean operator==(\r
+       const CIMDateTime& x,\r
+       const CIMDateTime& y);\r
+\r
+private:\r
+\r
+    Boolean _set(const char* str);\r
+    char _rep[FORMAT_LENGTH + 1];\r
+};\r
+\r
+PEGASUS_COMMON_LINKAGE Boolean operator==(\r
+    const CIMDateTime& x, \r
+    const CIMDateTime& y);\r
+\r
+PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(\r
+    PEGASUS_STD(ostream)& os, \r
+    const CIMDateTime& x);\r
+\r
+#define PEGASUS_ARRAY_T CIMDateTime\r
+# include "ArrayInter.h"\r
+#undef PEGASUS_ARRAY_T\r
+\r
+PEGASUS_NAMESPACE_END\r
+\r
+#endif /* Pegasus_DateTime_h */\r