cfg_contents.cpp

00001 /*
00002  *  TOPPERS/FDMP Kernel
00003  *      Toyohashi Open Platform for Embedded Real-Time Systems/
00004  *      Function Distributed Multiprocessor Kernel
00005  *
00006  *  Copyright (C) 2005 by Takagi Nobuhisa
00007  * 
00008  *  上記著作権者は,以下の (1)〜(4) の条件か,Free Software Foundation 
00009  *  によって公表されている GNU General Public License の Version 2 に記
00010  *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
00011  *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
00012  *  利用と呼ぶ)することを無償で許諾する.
00013  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
00014  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
00015  *      スコード中に含まれていること.
00016  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
00017  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
00018  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
00019  *      の無保証規定を掲載すること.
00020  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
00021  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
00022  *      と.
00023  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
00024  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
00025  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
00026  *        報告すること.
00027  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
00028  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
00029  * 
00030  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
00031  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
00032  *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
00033  *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
00034  * 
00035  */
00036 
00037 /*
00038  *  toppers/itron/cfg_contents.cpp
00039  */
00040 #include "toppers/itron/cfg_contents.hpp"
00041 #include "toppers/itron/static_api.hpp"
00042 #include "toppers/itron/kernel_object.hpp"
00043 #include <algorithm>
00044 
00045 namespace toppers
00046 {
00047   namespace itron
00048   {
00049 
00056     bool cfg_contents::parse( text::const_iterator& next, text::const_iterator last )
00057     {
00058       text::const_iterator iter( next );
00059       if ( !do_parse( iter, last, ucn_, codeset_ ) )
00060       {
00061         return false;
00062       }
00063       next = iter;
00064       return true;
00065     }
00066 
00071     void cfg_contents::swap( cfg_contents& other ) throw()
00072     {
00073       groups_.swap( other.groups_ );
00074       name_.swap( other.name_ );
00075       std::swap( ucn_, other.ucn_ );
00076       std::swap( codeset_, other.codeset_ );
00077     }
00078 
00084     const boost::shared_ptr<std::vector<boost::shared_ptr<cfg_contents> > > cfg_contents::do_classify( bool, codeset_t ) const
00085     {
00086       typedef std::vector<boost::shared_ptr<cfg_contents> > vector_t;
00087       boost::shared_ptr<vector_t> v( new vector_t );
00088 
00089       if ( !kernel_object::assign_id( groups().front()->objects().begin(), groups().front()->objects().end() ) )
00090       {
00091         v.reset();
00092         return v;
00093       }
00094 
00095       v->push_back( boost::shared_ptr<cfg_contents>( new cfg_contents( *this ) ) );
00096       return v;
00097     }
00098 
00107     bool cfg_contents::do_parse( text::const_iterator& next, text::const_iterator last, bool ucn, codeset_t codeset )
00108     {
00109       text::const_iterator iter( next );
00110       if ( iter != last )
00111       {
00112         boost::shared_ptr<cfg_group> g( new cfg_group( "" ) );
00113         if ( !g->parse( iter, last, ucn, codeset ) )
00114         {
00115           return false;
00116         }
00117         if ( iter != last )
00118         {
00119           error( get_text_line( iter ), _( "syntax error" ) );
00120         }
00121         groups_.push_back( g );
00122       }
00123       next = iter;
00124       return true;
00125     }
00126 
00127   }
00128 }

Copyright © 2006 by TAKAGI Nobuhisa.
このページは Wed Apr 12 16:31:56 2006 に Doxygen によって生成されました。