Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.2.0)

E77779-01

coherence/io/pof/RawDate.hpp

00001 /*
00002 * RawDate.hpp
00003 *
00004 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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 "coherence/io/pof/PofIntrinsic.hpp"
00022 
00023 
00024 #include <time.h>
00025 
00026 COH_OPEN_NAMESPACE3(coherence,io,pof)
00027 
00028 
00029 /**
00030 * Raw immutable POF date value.
00031 *
00032 * @author jh  2008.04.08
00033 */
00034 class COH_EXPORT RawDate
00035     : public cloneable_spec<RawDate,
00036           extends<Object>,
00037           implements<PofIntrinsic> >
00038     {
00039     friend class factory<RawDate>;
00040 
00041     // ----- typedefs -------------------------------------------------------
00042 
00043     public:
00044         /**
00045         * The boxed native type.
00046         */
00047         typedef struct tm BoxedType;
00048 
00049 
00050     // ----- constructors ---------------------------------------------------
00051 
00052     protected:
00053         /**
00054         * Construct a raw POF date value.
00055         *
00056         * @param nYear   the year number as defined by ISO8601
00057         * @param nMonth  the month number between 1 and 12 inclusive as
00058         *                defined by ISO8601
00059         * @param nDay    the day number between 1 and 31 inclusive as defined
00060         *                by ISO8601
00061         *
00062         * @return the new RawDate
00063         */
00064         RawDate(int32_t nYear, int32_t nMonth, int32_t nDay);
00065 
00066         /**
00067         * Construct a raw POF date value from a POSIX datetime struct.
00068         */
00069         RawDate(const struct tm& timeinfo);
00070 
00071         /**
00072         * Copy constructor.
00073         */
00074         RawDate(const RawDate& that);
00075 
00076 
00077     // ----- Object interface -----------------------------------------------
00078 
00079     public:
00080         /**
00081         * {@inheritDoc}
00082         */
00083         virtual bool equals(Object::View v) const;
00084 
00085         /**
00086         * {@inheritDoc}
00087         */
00088         virtual size32_t hashCode() const;
00089 
00090         /**
00091         * {@inheritDoc}
00092         */
00093         virtual bool isImmutable() const;
00094 
00095         /**
00096         * {@inheritDoc}
00097         */
00098         virtual TypedHandle<const String> toString() const;
00099 
00100 
00101     // ----- accessors ------------------------------------------------------
00102 
00103     public:
00104         /**
00105         * Determine the date's year value.
00106         *
00107         * @return the year number as defined by ISO8601
00108         */
00109         virtual int32_t getYear() const;
00110 
00111         /**
00112         * Determine the date's month value.
00113         *
00114         * @return the month number between 1 and 12 inclusive as defined by
00115         *         ISO8601
00116         */
00117         virtual int32_t getMonth() const;
00118 
00119         /**
00120         * Determine the date's day value.
00121         *
00122         * @return the day number between 1 and 31 inclusive as defined by
00123         *         ISO8601
00124         */
00125         virtual int32_t getDay() const;
00126 
00127         /**
00128         * Convert the RawDate to a POSIX datetime struct.
00129         */
00130         virtual operator struct tm() const;
00131 
00132     // ----- data members ---------------------------------------------------
00133 
00134     protected:
00135         /**
00136         * The year number.
00137         */
00138         int32_t m_nYear;
00139 
00140         /**
00141         * The month number.
00142         */
00143         int32_t m_nMonth;
00144 
00145         /**
00146         * The day number.
00147         */
00148         int32_t m_nDay;
00149     };
00150 
00151 COH_CLOSE_NAMESPACE3
00152 
00153 #endif // COH_RAW_DATE_HPP
Copyright © 2000, 2016, Oracle and/or its affiliates. All rights reserved.