xlnt
named_range.hpp
1 // Copyright (c) 2014-2022 Thomas Fussell
2 // Copyright (c) 2010-2015 openpyxl
3 // Copyright (c) 2024 xlnt-community
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE
22 //
23 // @license: http://www.opensource.org/licenses/mit-license.php
24 // @author: see AUTHORS file
25 
26 #pragma once
27 
28 #include <string>
29 #include <vector>
30 
31 #include <xlnt/xlnt_config.hpp>
32 
33 namespace xlnt {
34 
35 class range_reference;
36 class worksheet;
37 
42 class XLNT_API named_range
43 {
44 public:
48  using target = std::pair<worksheet, range_reference>;
49 
53  named_range();
54 
58  named_range(const named_range &other);
59 
63  named_range(const std::string &name, const std::vector<target> &targets);
64 
68  std::string name() const;
69 
73  const std::vector<target> &targets() const;
74 
78  named_range &operator=(const named_range &other);
79 
80  bool operator==(const named_range &rhs) const;
81 
82 private:
86  std::string name_;
87 
91  std::vector<target> targets_;
92 };
93 
94 } // namespace xlnt
Enumerates the possible types a cell can be determined by it&#39;s current value.
Definition: cell.hpp:37
bool operator==(std::nullptr_t, const cell &cell)
Returns true if this cell is uninitialized.
std::pair< worksheet, range_reference > target
Type alias for the combination of sheet and range this named_range points to.
Definition: named_range.hpp:48
A 2D range of cells in a worksheet that is referred to by name. ws->range("A1:B2") could be replaced ...
Definition: named_range.hpp:42