coherence/io/pof/RawDate.hpp

00001 /*
00002 * RawDate.hpp
00003 *
00004 * Copyright 2001-2008 by Oracle. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_RAW_DATE_HPP
00017 #define COH_RAW_DATE_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include <ostream>
00022 
00023 COH_OPEN_NAMESPACE3(coherence,io,pof)
00024 
00025 
00026 /**
00027 * Raw immutable POF date value.
00028 *
00029 * @author jh  2008.04.08
00030 */
00031 class COH_EXPORT RawDate
00032     : public cloneable_spec<RawDate>
00033     {
00034     friend class factory<RawDate>;
00035 
00036     // ----- constructors ---------------------------------------------------
00037 
00038     protected:
00039         /**
00040         * Construct a raw POF date value.
00041         *
00042         * @param nYear   the year number as defined by ISO8601
00043         * @param nMonth  the month number between 1 and 12 inclusive as
00044         *                defined by ISO8601
00045         * @param nDay    the day number between 1 and 31 inclusive as defined
00046         *                by ISO8601
00047         *
00048         * @return the new RawDate
00049         */
00050         RawDate(int32_t nYear, int32_t nMonth, int32_t nDay);
00051 
00052         /**
00053         * Copy constructor.
00054         */
00055         RawDate(const RawDate& that);
00056 
00057 
00058     // ----- Object interface -----------------------------------------------
00059 
00060     public:
00061         /**
00062         * {@inheritDoc}
00063         */
00064         virtual bool equals(Object::View v) const;
00065 
00066         /**
00067         * {@inheritDoc}
00068         */
00069         virtual size32_t hashCode() const;
00070 
00071         /**
00072         * {@inheritDoc}
00073         */
00074         virtual bool isImmutable() const;
00075 
00076         /**
00077         * {@inheritDoc}
00078         */
00079         virtual void toStream(std::ostream &out) const;
00080 
00081 
00082     // ----- accessors ------------------------------------------------------
00083 
00084     public:
00085         /**
00086         * Determine the date's year value.
00087         *
00088         * @return the year number as defined by ISO8601
00089         */
00090         virtual int32_t getYear() const;
00091 
00092         /**
00093         * Determine the date's month value.
00094         *
00095         * @return the month number between 1 and 12 inclusive as defined by
00096         *         ISO8601
00097         */
00098         virtual int32_t getMonth() const;
00099 
00100         /**
00101         * Determine the date's day value.
00102         *
00103         * @return the day number between 1 and 31 inclusive as defined by
00104         *         ISO8601
00105         */
00106         virtual int32_t getDay() const;
00107 
00108 
00109     // ----- data members ---------------------------------------------------
00110 
00111     protected:
00112         /**
00113         * The year number.
00114         */
00115         int32_t m_nYear;
00116 
00117         /**
00118         * The month number.
00119         */
00120         int32_t m_nMonth;
00121 
00122         /**
00123         * The day number.
00124         */
00125         int32_t m_nDay;
00126     };
00127 
00128 COH_CLOSE_NAMESPACE3
00129 
00130 #endif // COH_RAW_DATE_HPP
Copyright (c) 2000-2008 Oracle. All rights reserved.