Ignore:
Timestamp:
05/03/11 15:50:52 (13 years ago)
Author:
hozdoba
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp

    r173 r188  
    77#include "group_template_impl.hpp" 
    88 
     9#include "calendar_type.hpp" 
     10 
    911namespace xmlioserver { 
    1012namespace tree { 
     
    1416   CContext::CContext(void) 
    1517      : CObjectTemplate<CContext>(), CContextAttributes() 
     18      , calendar() 
    1619   { /* Ne rien faire de plus */ } 
    1720 
    1821   CContext::CContext(const StdString & id) 
    1922      : CObjectTemplate<CContext>(id), CContextAttributes() 
     23      , calendar() 
    2024   { /* Ne rien faire de plus */ } 
    2125 
     
    3741      return (group_context);  
    3842   } 
    39  
     43    
     44   //---------------------------------------------------------------- 
     45    
     46   boost::shared_ptr<date::CCalendar> CContext::getCalendar(void) const 
     47   { 
     48      return (this->calendar); 
     49   } 
     50    
     51   //---------------------------------------------------------------- 
     52    
     53   void CContext::setCalendar(boost::shared_ptr<date::CCalendar> newCalendar) 
     54   { 
     55      this->calendar = newCalendar; 
     56      calendar_type.setValue(this->calendar->getId()); 
     57      start_date.setValue(this->calendar->getInitDate().toString()); 
     58   } 
     59    
     60   //---------------------------------------------------------------- 
     61 
     62   void CContext::solveCalendar(void) 
     63   { 
     64      if (this->calendar.get() != NULL) return; 
     65      if (calendar_type.isEmpty() || start_date.isEmpty()) 
     66         ERROR(" CContext::solveCalendar(void)", 
     67               << "[ context id = " << this->getId() << " ] " 
     68               << "Impossible de définir un calendrier (un attribut est manquant)."); 
     69 
     70#define DECLARE_CALENDAR(MType  , mtype)                        \ 
     71   if (calendar_type.getValue().compare(#mtype) == 0)           \ 
     72   {                                                            \ 
     73      this->calendar =  boost::shared_ptr<date::CCalendar>      \ 
     74         (new date::C##MType##Calendar(start_date.getValue())); \ 
     75      return;                                                   \ 
     76   } 
     77#include "calendar_type.conf" 
     78 
     79      ERROR("CContext::solveCalendar(void)", 
     80            << "[ calendar_type = " << calendar_type.getValue() << " ] " 
     81            << "Le calendrier n'est pas définie dans le code !"); 
     82   } 
     83    
    4084   //---------------------------------------------------------------- 
    4185 
Note: See TracChangeset for help on using the changeset viewer.