axis2_date_time.h

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

Generated on Tue Oct 3 20:47:58 2006 for Axis2/C by  doxygen 1.4.7