// Copyright (c) 2014-2017 Thomas Fussell // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE // // @license: http://www.opensource.org/licenses/mit-license.php // @author: see AUTHORS file #pragma once #include #include #include #include #include #include #include #include #include #include #include namespace xlnt { class const_range_iterator; class range_iterator; /// /// A range is a 2D collection of cells with defined extens that can be iterated upon. /// class XLNT_API range { public: /// /// /// using iterator = range_iterator; /// /// /// using const_iterator = const_range_iterator; /// /// /// using reverse_iterator = std::reverse_iterator; /// /// /// using const_reverse_iterator = std::reverse_iterator; /// /// /// range(worksheet ws, const range_reference &reference, major_order order = major_order::row, bool skip_null = false); /// /// /// ~range(); /// /// /// range(const range &) = default; /// /// /// cell_vector operator[](std::size_t vector_index); /// /// /// const cell_vector operator[](std::size_t vector_index) const; /// /// /// bool operator==(const range &comparand) const; /// /// /// bool operator!=(const range &comparand) const; /// /// /// cell_vector vector(std::size_t vector_index); /// /// /// const cell_vector vector(std::size_t vector_index) const; /// /// /// class cell cell(const cell_reference &ref); /// /// /// const class cell cell(const cell_reference &ref) const; /// /// /// range_reference reference() const; /// /// /// std::size_t length() const; /// /// /// bool contains(const cell_reference &ref); /// /// /// range alignment(const xlnt::alignment &new_alignment); /// /// /// range border(const xlnt::border &new_border); /// /// /// range fill(const xlnt::fill &new_fill); /// /// /// range font(const xlnt::font &new_font); /// /// /// range number_format(const xlnt::number_format &new_number_format); /// /// /// range protection(const xlnt::protection &new_protection); /// /// Sets the named style applied to all cells in this range to a style named style_name. /// range style(const class style &new_style); /// /// Sets the named style applied to all cells in this range to a style named style_name. /// If this style has not been previously created in the workbook, a /// key_not_found exception will be thrown. /// range style(const std::string &style_name); /// /// /// iterator begin(); /// /// /// iterator end(); /// /// /// const_iterator begin() const; /// /// /// const_iterator end() const; /// /// /// const_iterator cbegin() const; /// /// /// const_iterator cend() const; /// /// /// reverse_iterator rbegin(); /// /// /// reverse_iterator rend(); /// /// /// const_reverse_iterator rbegin() const; /// /// /// const_reverse_iterator rend() const; /// /// /// const_reverse_iterator crbegin() const; /// /// /// const_reverse_iterator crend() const; /// /// /// void apply(std::function f); private: /// /// /// worksheet ws_; /// /// /// range_reference ref_; /// /// /// major_order order_; /// /// /// bool skip_null_; }; } // namespace xlnt