axis2_date_time.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017   
00018 #ifndef AXIS2_DATE_TIME_H
00019 #define AXIS2_DATE_TIME_H
00020 
00021 #include <axis2_utils_defines.h>
00022 #include <axis2_env.h>
00023  
00029 #ifdef __cplusplus
00030 extern "C"
00031 {
00032 #endif
00033    
00041 typedef struct axis2_date_time_ops axis2_date_time_ops_t;   
00042 typedef struct axis2_date_time axis2_date_time_t;
00043 
00044  struct axis2_date_time_ops
00045 {
00052     axis2_status_t (AXIS2_CALL * 
00053     free)(axis2_date_time_t *date_time,
00054             const axis2_env_t *env);
00055     
00063     axis2_status_t (AXIS2_CALL *
00064     deserialize_time) (axis2_date_time_t *date_time,
00065                         const axis2_env_t *env,
00066                         const char* time_str);
00067     
00075     axis2_status_t (AXIS2_CALL *
00076     deserialize_date) (axis2_date_time_t *date_time,
00077                         const axis2_env_t *env,
00078                         const char* date_str);
00079     
00087     axis2_status_t (AXIS2_CALL *
00088     deserialize_date_time) (axis2_date_time_t *date_time,
00089                         const axis2_env_t *env,
00090                         const char* date_time_str);
00091     
00104     axis2_status_t (AXIS2_CALL*
00105     set_date_time ) (axis2_date_time_t* date_time,
00106                         const axis2_env_t *env,
00107                         int year, int month, int date,
00108                         int hour, int min, int second,int milliseconds);
00109  
00116     char* (AXIS2_CALL *
00117     serialize_time) (axis2_date_time_t *date_time,
00118                         const axis2_env_t *env );
00119   
00126     char* (AXIS2_CALL *
00127     serialize_date) (axis2_date_time_t *date_time,
00128                         const axis2_env_t *env );
00129    
00136     char* (AXIS2_CALL *
00137     serialize_date_time) (axis2_date_time_t *date_time,
00138                         const axis2_env_t *env );
00139    
00146     int (AXIS2_CALL *
00147     get_year)(axis2_date_time_t *date_time,
00148                         const axis2_env_t *env );
00149     
00156     int (AXIS2_CALL *
00157     get_month)(axis2_date_time_t *date_time,
00158                         const axis2_env_t *env );
00159     
00166     int (AXIS2_CALL *
00167     get_date)(axis2_date_time_t *date_time,
00168                         const axis2_env_t *env );
00169     
00176     int (AXIS2_CALL *
00177     get_hour)(axis2_date_time_t *date_time,
00178                         const axis2_env_t *env );
00179     
00186     int (AXIS2_CALL *
00187     get_minute)(axis2_date_time_t *date_time,
00188                         const axis2_env_t *env );
00189     
00196     int (AXIS2_CALL *
00197     get_second)(axis2_date_time_t *date_time,
00198                         const axis2_env_t *env );
00199     
00200     int (AXIS2_CALL *
00201     get_msec)(axis2_date_time_t *date_time,
00202                         const axis2_env_t *env );
00203    
00204 } ;
00205 
00206  struct axis2_date_time 
00207 {
00208     axis2_date_time_ops_t *ops;
00209 };
00210 
00216 AXIS2_EXTERN axis2_date_time_t * AXIS2_CALL
00217 axis2_date_time_create(const axis2_env_t *env );
00218 
00219 /*
00220  * Creates axis2_date_time struct with an additional offset value
00221  * If the offset is a positive value then the time will be in the future 
00222  *        offset is 0, then the time will be the current time
00223  *        offset is a negative value then the time is in the past.
00224  * @param env double pointer to environment struct. MUST NOT be NULL
00225  * @param offset the offset from the current time in seconds
00226  * @return pointer to newly created axis2_date_time struct
00227  **/
00228 AXIS2_EXTERN axis2_date_time_t * AXIS2_CALL
00229 axis2_date_time_create_with_offset (const axis2_env_t *env, int offset);
00230 
00231 /*************************** Function macros **********************************/
00232 
00233 #define AXIS2_DATE_TIME_FREE(date_time, env) \
00234         ((date_time)->ops->free (date_time, env))
00235 
00236 #define AXIS2_DATE_TIME_DESERIALIZE_TIME(date_time, env, time ) \
00237         ((date_time)->ops->deserialize_time (date_time, env, time))
00238 
00239 #define AXIS2_DATE_TIME_DESERIALIZE_DATE(date_time, env, date) \
00240         ((date_time)->ops->deserialize_date (date_time, env, date_str))
00241 
00242 #define AXIS2_DATE_TIME_DESERIALIZE_DATE_TIME(date_time, env, date_time_str ) \
00243         ((date_time)->ops->deserialize_date_time(date_time, env, date_time_str))
00244 
00245 #define AXIS2_DATE_TIME_SET_DATE_TIME(date_time, env, \
00246                            year, month, date, hour, min, second, milliseconds ) \
00247         ((date_time)->ops->set_date_time (date_time, env, \
00248                            year, month, date, hour, min, second, milliseconds) )
00249  
00250 #define AXIS2_DATE_TIME_SERIALIZE_TIME(date_time, env) \
00251         ((date_time)->ops->serialize_time (date_time, env ) )
00252                               
00253 #define AXIS2_DATE_TIME_SERIALIZE_DATE(date_time, env) \
00254         ((date_time)->ops->serialize_date (date_time, env ) )
00255 
00256 #define AXIS2_DATE_TIME_SERIALIZE_DATE_TIME(date_time, env) \
00257         ((date_time)->ops->serialize_date_time (date_time, env ) )
00258 
00259 #define AXIS2_DATE_TIME_GET_YEAR(date_time, env) \
00260         ((date_time)->ops->get_year(date_time, env ) )
00261 
00262 #define AXIS2_DATE_TIME_GET_MONTH(date_time, env) \
00263         ((date_time)->ops->get_month(date_time, env ) )
00264 
00265 #define AXIS2_DATE_TIME_GET_DATE(date_time, env) \
00266         ((date_time)->ops->get_date(date_time, env ) )
00267 
00268 #define AXIS2_DATE_TIME_GET_HOUR(date_time, env) \
00269         ((date_time)->ops->get_hour(date_time, env ) )
00270 
00271 #define AXIS2_DATE_TIME_GET_MINUTE(date_time, env) \
00272         ((date_time)->ops->get_minute(date_time, env ) )
00273 
00274 #define AXIS2_DATE_TIME_GET_SECOND(date_time, env) \
00275         ((date_time)->ops->get_second(date_time, env ) )
00276 
00277 #define AXIS2_DATE_TIME_GET_MSEC(date_time, env) \
00278         ((date_time)->ops->get_msec(date_time, env ) )
00279 
00280 
00281 
00284 #ifdef __cplusplus
00285 }
00286 #endif
00287 
00288 #endif /* AXIS2_DATE_TIME_H */

Generated on Wed Dec 20 20:34:49 2006 for Axis2/C by  doxygen 1.5.1