Tide 0.1.0

ebml_element.h

Go to the documentation of this file.
00001 /* Tide
00002  *
00003  * Header file for the EBML element object.
00004  *
00005  * Copyright 2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
00006  *     RT-Synthesis Research Group
00007  *     Intelligent Systems Research Institute,
00008  *     National Institute of Advanced Industrial Science and Technology (AIST),
00009  *     Japan
00010  *     All rights reserved.
00011  *
00012  * This file is part of Tide.
00013  *
00014  * Tide is free software; you can redistribute it and/or modify it under
00015  * the terms of the GNU Lesser General Public License as published by
00016  * the Free Software Foundation; either version 2.1 of the License, or
00017  * (at your option) any later version.
00018  *
00019  * Tide is distributed in the hope that it will be useful, but WITHOUT
00020  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00021  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00022  * License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with Tide. If not, see <http://www.gnu.org/licenses/>.
00026  */
00027 
00028 #if !defined(TIDE_EBML_ELEMENT_H_)
00029 #define TIDE_EBML_ELEMENT_H_
00030 
00031 #include <tide/el_ids.h>
00032 #include <tide/master_element.h>
00033 #include <tide/tide_config.h>
00034 #include <tide/string_element.h>
00035 #include <tide/uint_element.h>
00036 #include <tide/win_dll.h>
00037 
00038 #include <string>
00039 
00042 
00043 namespace tide
00044 {
00052     class TIDE_EXPORT EBMLElement : public MasterElement
00053     {
00054         public:
00063             EBMLElement(std::string const& doc_type="tide");
00064 
00066             virtual ~EBMLElement() {};
00067 
00074             unsigned int version() const { return ver_.value(); }
00081             unsigned int read_version() const { return read_ver_.value(); }
00087             unsigned int max_id_length() const
00088                 { return max_id_length_.value(); }
00090             void max_id_length(unsigned int max_id_length)
00091                 { max_id_length_.value(max_id_length); }
00097             unsigned int max_size_length() const
00098                 { return max_size_length_.value(); }
00100             void max_size_length(unsigned int max_size_length)
00101                 { max_size_length_.value(max_size_length); }
00107             std::string doc_type() const { return doc_type_.value(); }
00109             void doc_type(std::string doc_type) { doc_type_.value(doc_type); }
00114             unsigned int doc_version() const { return doc_type_ver_.value(); }
00116             void doc_version(unsigned int doc_version)
00117                 { doc_type_ver_.value(doc_version); }
00123             unsigned int doc_read_version() const
00124                 { return doc_type_read_ver_.value(); }
00126             void doc_read_version(unsigned int doc_read_version)
00127                 { doc_type_read_ver_.value(doc_read_version); }
00128 
00130             virtual std::streamsize write_body(std::ostream& output);
00131 
00132         protected:
00134             UIntElement ver_;
00136             UIntElement read_ver_;
00138             UIntElement max_id_length_;
00140             UIntElement max_size_length_;
00142             StringElement doc_type_;
00144             UIntElement doc_type_ver_;
00146             UIntElement doc_type_read_ver_;
00147 
00149             virtual std::streamsize body_size() const;
00150 
00152             virtual std::streamsize read_body(std::istream& input,
00153                     std::streamsize size);
00154 
00156             void set_defaults_();
00157     }; // class Element
00158 }; // namespace tide
00159 
00162 
00163 #endif // TIDE_EBML_ELEMENT_H_
00164 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines