images_document.h

Go to the documentation of this file.
00001 /*
00002  * File Name: images_document.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-images.
00007  *
00008  * uds-plugin-images is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-images is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 #ifndef IMAGES_DOCUMENT_H_
00028 #define IMAGES_DOCUMENT_H_
00029 
00030 #include <vector>
00031 #include <string>
00032 #include "images_scanner.h"
00033 
00034 namespace images
00035 {
00036 
00037 /// Handle images file format
00038 class ImagesDocument
00039 {
00040 public:
00041     ImagesDocument(void);
00042     ~ImagesDocument(void);
00043 
00044     /// Open .images index file.
00045     bool open_document(const std::string &path, bool to_scan_dir = true);
00046 
00047     /// Check if the document has been opened.
00048     bool is_open();
00049 
00050     /// How many "page" does it contain.
00051     unsigned int page_count();
00052 
00053     /// Get the initial page number
00054     int get_initial_page_num();
00055 
00056     /// Retrieve specified page.
00057     const ImagePtr get_page(const unsigned int page_number);
00058 
00059     /// Retrieve page from anchor.
00060     int get_page(const std::string & anchor);
00061 
00062     bool get_page_name(const std::string & anchor,
00063                        std::string & name);
00064 
00065     /// Close and release all allocated resource.
00066     bool close_document();
00067 
00068     /// Anchor policy: Use path name of image as the anchor.
00069     /// Get anchor for specified page.
00070     bool get_anchor_of_page(const unsigned int page_number, 
00071                             std::string & anchor);
00072 
00073     /// Check the document contains the anchor or not.
00074     bool has_anchor(const std::string & anchor);
00075 
00076     /// Find position from the anchor.
00077     int get_position(const std::string & anchor);
00078 
00079     /// Compare the anchor object.
00080     int compare_anchor(const std::string & first,
00081                        const std::string & second);
00082 
00083     /// Anchor iteraotr: retrieve the previous anchor.
00084     bool get_prev_page(std::string & anchor);
00085 
00086     /// Anchor iteraotr: retrieve the next anchor.
00087     bool get_next_page(std::string & anchor);
00088 
00089     bool get_original_size(const std::string &anchor, 
00090                            unsigned int & width,
00091                            unsigned int & height);
00092 
00093     bool get_original_rotation(const std::string & anchor,
00094                                PluginRotationDegree & rotation);
00095 
00096 private:
00097     Images images;
00098     int initial_page_num;
00099 };
00100 
00101 };  // namespace images
00102 
00103 #endif
00104 
Generated by  doxygen 1.6.2-20100208