react-native-nitro-xlsx 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +20 -8
  2. package/cpp/HybridNitroXlsx.cpp +25 -1
  3. package/cpp/HybridXlsxCellFormat.cpp +46 -146
  4. package/cpp/HybridXlsxCellFormat.hpp +9 -41
  5. package/cpp/HybridXlsxConditionalFormat.cpp +4 -1
  6. package/cpp/HybridXlsxConditionalFormats.cpp +5 -1
  7. package/cpp/HybridXlsxWorkbook.cpp +38 -8
  8. package/cpp/HybridXlsxWorkbook.hpp +10 -1
  9. package/cpp/HybridXlsxWorksheet.cpp +422 -141
  10. package/cpp/HybridXlsxWorksheet.hpp +4 -1
  11. package/cpp/XlsxCacheDir.cpp +25 -2
  12. package/cpp/XlsxCacheDir.hpp +3 -1
  13. package/cpp/XlsxCellStyle.hpp +360 -0
  14. package/cpp/XlsxJson.cpp +29 -8
  15. package/package.json +1 -1
  16. package/scripts/sync-openxlsx-headers.sh +34 -0
  17. package/src/__mocks__/react-native-nitro-modules.ts +523 -20
  18. package/src/__tests__/index.test.ts +124 -16
  19. package/src/index.ts +13 -13
  20. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/IZipArchive.hpp +361 -0
  21. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/OpenXLSX-Exports.hpp +12 -0
  22. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCell.hpp +367 -0
  23. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellIterator.hpp +252 -0
  24. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellRange.hpp +223 -0
  25. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellReference.hpp +317 -0
  26. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellValue.hpp +793 -0
  27. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColor.hpp +232 -0
  28. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColumn.hpp +159 -0
  29. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCommandQuery.hpp +228 -0
  30. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLComments.hpp +270 -0
  31. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLConstants.hpp +18 -0
  32. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLContentTypes.hpp +264 -0
  33. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDateTime.hpp +175 -0
  34. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDocument.hpp +505 -0
  35. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDrawing.hpp +452 -0
  36. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLException.hpp +161 -0
  37. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLFormula.hpp +375 -0
  38. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLIterator.hpp +40 -0
  39. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLMergeCells.hpp +216 -0
  40. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLProperties.hpp +348 -0
  41. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRelationships.hpp +348 -0
  42. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRow.hpp +721 -0
  43. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRowData.hpp +488 -0
  44. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSharedStrings.hpp +204 -0
  45. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSheet.hpp +1640 -0
  46. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLStyles.hpp +2390 -0
  47. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLTables.hpp +132 -0
  48. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLWorkbook.hpp +404 -0
  49. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlData.hpp +283 -0
  50. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlFile.hpp +194 -0
  51. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParser.hpp +282 -0
  52. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParserForwardDeclarations.hpp +85 -0
  53. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLZipArchive.hpp +232 -0
  54. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/LibZip.hpp +447 -0
  55. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/OpenXLSXFileSystemTools.hpp +207 -0
  56. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/Zippy.hpp +1375 -0
  57. package/thirdparty/README.md +7 -3
@@ -0,0 +1,223 @@
1
+ /*
2
+
3
+ ____ ____ ___ ____ ____ ____ ___
4
+ 6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
5
+ 8P Y8 `MM. d' MM 6M' ` `MM. d'
6
+ 6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
7
+ MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
8
+ MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
9
+ MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
10
+ MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
11
+ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
12
+ 8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
13
+ YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
14
+ MM
15
+ MM
16
+ _MM_
17
+
18
+ Copyright (c) 2018, Kenneth Troldal Balslev
19
+
20
+ All rights reserved.
21
+
22
+ Redistribution and use in source and binary forms, with or without
23
+ modification, are permitted provided that the following conditions are met:
24
+ - Redistributions of source code must retain the above copyright
25
+ notice, this list of conditions and the following disclaimer.
26
+ - Redistributions in binary form must reproduce the above copyright
27
+ notice, this list of conditions and the following disclaimer in the
28
+ documentation and/or other materials provided with the distribution.
29
+ - Neither the name of the author nor the
30
+ names of any contributors may be used to endorse or promote products
31
+ derived from this software without specific prior written permission.
32
+
33
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
37
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
40
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
+
44
+ */
45
+
46
+ #ifndef OPENXLSX_XLCELLRANGE_HPP
47
+ #define OPENXLSX_XLCELLRANGE_HPP
48
+
49
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
50
+ # pragma warning(push)
51
+ # pragma warning(disable : 4251)
52
+ # pragma warning(disable : 4275)
53
+ #endif // _MSC_VER
54
+
55
+ // ===== External Includes ===== //
56
+ #include <memory>
57
+
58
+ // ===== OpenXLSX Includes ===== //
59
+ #include "OpenXLSX-Exports.hpp"
60
+ #include "XLCell.hpp"
61
+ #include "XLCellIterator.hpp"
62
+ #include "XLCellReference.hpp"
63
+ #include "XLXmlParserForwardDeclarations.hpp"
64
+
65
+ namespace OpenXLSX
66
+ {
67
+ /**
68
+ * @brief This class encapsulates the concept of a cell range, i.e. a square area
69
+ * (or subset) of cells in a spreadsheet.
70
+ */
71
+ class OPENXLSX_EXPORT XLCellRange
72
+ {
73
+ friend class XLCellIterator;
74
+
75
+ //----------------------------------------------------------------------------------------------------------------------
76
+ // Public Member Functions
77
+ //----------------------------------------------------------------------------------------------------------------------
78
+
79
+ public:
80
+ /**
81
+ * @brief Default constructor for variable declaration
82
+ */
83
+ XLCellRange();
84
+
85
+ /**
86
+ * @brief
87
+ * @param dataNode
88
+ * @param topLeft
89
+ * @param bottomRight
90
+ * @param sharedStrings
91
+ */
92
+ explicit XLCellRange(const XMLNode& dataNode,
93
+ const XLCellReference& topLeft,
94
+ const XLCellReference& bottomRight,
95
+ const XLSharedStrings& sharedStrings);
96
+
97
+ /**
98
+ * @brief Copy constructor
99
+ * @param other The range object to be copied.
100
+ */
101
+ XLCellRange(const XLCellRange& other);
102
+
103
+ /**
104
+ * @brief Move constructor [default]
105
+ * @param other The range object to be moved.
106
+ */
107
+ XLCellRange(XLCellRange&& other) noexcept;
108
+
109
+ /**
110
+ * @brief Destructor [default]
111
+ */
112
+ ~XLCellRange();
113
+
114
+ /**
115
+ * @brief The copy assignment operator
116
+ * @param other The range object to be copied and assigned.
117
+ * @return reference to the new object.
118
+ */
119
+ XLCellRange& operator=(const XLCellRange& other);
120
+
121
+ /**
122
+ * @brief The move assignment operator [default].
123
+ * @param other The range object to be moved and assigned.
124
+ * @return A reference to the new object.
125
+ */
126
+ XLCellRange& operator=(XLCellRange&& other) noexcept;
127
+
128
+ /**
129
+ * @brief populate the m_columnStyles
130
+ * @return a const XLCellReference
131
+ */
132
+ void fetchColumnStyles();
133
+
134
+ /**
135
+ * @brief get the top left cell
136
+ * @return a const XLCellReference
137
+ */
138
+ const XLCellReference topLeft() const;
139
+
140
+ /**
141
+ * @brief get the bottom right cell
142
+ * @return a const XLCellReference
143
+ */
144
+ const XLCellReference bottomRight() const;
145
+
146
+ /**
147
+ * @brief get the string reference that corresponds to the represented cell range
148
+ * @return a std::string range reference, e.g. "A2:Z5"
149
+ */
150
+ std::string address() const;
151
+
152
+ /**
153
+ * @brief Get the number of rows in the range.
154
+ * @return The number of rows.
155
+ */
156
+ uint32_t numRows() const;
157
+
158
+ /**
159
+ * @brief Get the number of columns in the range.
160
+ * @return The number of columns.
161
+ */
162
+ uint16_t numColumns() const;
163
+
164
+ /**
165
+ * @brief
166
+ * @return
167
+ */
168
+ XLCellIterator begin() const;
169
+
170
+ /**
171
+ * @brief
172
+ * @return
173
+ */
174
+ XLCellIterator end() const;
175
+
176
+ /**
177
+ * @brief
178
+ */
179
+ void clear();
180
+
181
+ /**
182
+ * @brief Templated assignment operator - assign value to a range of cells
183
+ * @tparam T The type of the value argument.
184
+ * @param value The value.
185
+ * @return A reference to the assigned-to object.
186
+ */
187
+ template<typename T,
188
+ typename = std::enable_if_t<
189
+ std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
190
+ std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
191
+ std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>>
192
+ XLCellRange& operator=(T value)
193
+ {
194
+ // forward implementation to templated XLCellValue& XLCellValue::operator=(T value)
195
+ for (auto it = begin(); it != end(); ++it) it->value() = value;
196
+ return *this;
197
+ }
198
+
199
+ /**
200
+ * @brief Set cell format for a range of cells
201
+ * @param cellFormatIndex The style to set, corresponding to the nidex of XLStyles::cellStyles()
202
+ * @returns true on success, false on failure
203
+ */
204
+ bool setFormat(XLStyleIndex cellFormatIndex);
205
+
206
+ //----------------------------------------------------------------------------------------------------------------------
207
+ // Private Member Variables
208
+ //----------------------------------------------------------------------------------------------------------------------
209
+
210
+ private:
211
+ std::unique_ptr<XMLNode> m_dataNode; /**< */
212
+ XLCellReference m_topLeft; /**< reference to the first cell in the range */
213
+ XLCellReference m_bottomRight; /**< reference to the last cell in the range */
214
+ XLSharedStringsRef m_sharedStrings; /**< reference to the document shared strings table */
215
+ std::vector<XLStyleIndex> m_columnStyles; /**< quick access to column styles in the range - populated by fetchColumnStyles() */
216
+ };
217
+ } // namespace OpenXLSX
218
+
219
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
220
+ # pragma warning(pop)
221
+ #endif // _MSC_VER
222
+
223
+ #endif // OPENXLSX_XLCELLRANGE_HPP
@@ -0,0 +1,317 @@
1
+ /*
2
+
3
+ ____ ____ ___ ____ ____ ____ ___
4
+ 6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
5
+ 8P Y8 `MM. d' MM 6M' ` `MM. d'
6
+ 6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
7
+ MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
8
+ MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
9
+ MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
10
+ MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
11
+ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
12
+ 8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
13
+ YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
14
+ MM
15
+ MM
16
+ _MM_
17
+
18
+ Copyright (c) 2018, Kenneth Troldal Balslev
19
+
20
+ All rights reserved.
21
+
22
+ Redistribution and use in source and binary forms, with or without
23
+ modification, are permitted provided that the following conditions are met:
24
+ - Redistributions of source code must retain the above copyright
25
+ notice, this list of conditions and the following disclaimer.
26
+ - Redistributions in binary form must reproduce the above copyright
27
+ notice, this list of conditions and the following disclaimer in the
28
+ documentation and/or other materials provided with the distribution.
29
+ - Neither the name of the author nor the
30
+ names of any contributors may be used to endorse or promote products
31
+ derived from this software without specific prior written permission.
32
+
33
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
37
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
40
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
+
44
+ */
45
+
46
+ #ifndef OPENXLSX_XLCELLREFERENCE_HPP
47
+ #define OPENXLSX_XLCELLREFERENCE_HPP
48
+
49
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
50
+ # pragma warning(push)
51
+ # pragma warning(disable : 4251)
52
+ # pragma warning(disable : 4275)
53
+ #endif // _MSC_VER
54
+
55
+ // ===== External Includes ===== //
56
+ #include <cstdint> // Pull request #276
57
+ #include <string>
58
+ #include <utility>
59
+
60
+ // ===== OpenXLSX Includes ===== //
61
+ #include "OpenXLSX-Exports.hpp"
62
+
63
+ namespace OpenXLSX
64
+ {
65
+ /**
66
+ * @brief
67
+ */
68
+ using XLCoordinates = std::pair<uint32_t, uint16_t>;
69
+
70
+ /**
71
+ * @brief
72
+ */
73
+ class OPENXLSX_EXPORT XLCellReference final
74
+ {
75
+ friend bool operator==(const XLCellReference& lhs, const XLCellReference& rhs);
76
+ friend bool operator!=(const XLCellReference& lhs, const XLCellReference& rhs);
77
+ friend bool operator<(const XLCellReference& lhs, const XLCellReference& rhs);
78
+ friend bool operator>(const XLCellReference& lhs, const XLCellReference& rhs);
79
+ friend bool operator<=(const XLCellReference& lhs, const XLCellReference& rhs);
80
+ friend bool operator>=(const XLCellReference& lhs, const XLCellReference& rhs);
81
+
82
+ //----------------------------------------------------------------------------------------------------------------------
83
+ // Public Member Functions
84
+ //----------------------------------------------------------------------------------------------------------------------
85
+
86
+ public:
87
+ /**
88
+ * @brief Constructor taking a cell address as argument.
89
+ * @param cellAddress The address of the cell, e.g. 'A1'.
90
+ * @details The constructor creates a new XLCellReference from a string, e.g. 'A1'. If there's no input,
91
+ * the default reference will be cell A1.
92
+ */
93
+ XLCellReference(const std::string& cellAddress = "A1"); // NOLINT
94
+
95
+ /**
96
+ * @brief Constructor taking the cell coordinates as arguments.
97
+ * @param row The row number of the cell.
98
+ * @param column The column number of the cell.
99
+ */
100
+ XLCellReference(uint32_t row, uint16_t column);
101
+
102
+ /**
103
+ * @brief Constructor taking the row number and the column letter as arguments.
104
+ * @param row The row number of the cell.
105
+ * @param column The column letter of the cell.
106
+ */
107
+ XLCellReference(uint32_t row, const std::string& column);
108
+
109
+ /**
110
+ * @brief Copy constructor
111
+ * @param other The object to be copied.
112
+ */
113
+ XLCellReference(const XLCellReference& other);
114
+
115
+ /**
116
+ * @brief
117
+ * @param other
118
+ */
119
+ XLCellReference(XLCellReference&& other) noexcept;
120
+
121
+ /**
122
+ * @brief Destructor. Default implementation used.
123
+ */
124
+ ~XLCellReference();
125
+
126
+ /**
127
+ * @brief Assignment operator.
128
+ * @param other The object to be copied/assigned.
129
+ * @return A reference to the new object.
130
+ */
131
+ XLCellReference& operator=(const XLCellReference& other);
132
+
133
+ /**
134
+ * @brief
135
+ * @param other
136
+ * @return
137
+ */
138
+ XLCellReference& operator=(XLCellReference&& other) noexcept;
139
+
140
+ /**
141
+ * @brief
142
+ * @return
143
+ */
144
+ XLCellReference& operator++();
145
+
146
+ /**
147
+ * @brief
148
+ * @return
149
+ */
150
+ XLCellReference operator++(int); // NOLINT
151
+
152
+ /**
153
+ * @brief
154
+ * @return
155
+ */
156
+ XLCellReference& operator--();
157
+
158
+ /**
159
+ * @brief
160
+ * @return
161
+ */
162
+ XLCellReference operator--(int); // NOLINT
163
+
164
+ /**
165
+ * @brief Get the row number of the XLCellReference.
166
+ * @return The row.
167
+ */
168
+ uint32_t row() const;
169
+
170
+ /**
171
+ * @brief Set the row number for the XLCellReference.
172
+ * @param row The row number.
173
+ */
174
+ void setRow(uint32_t row);
175
+
176
+ /**
177
+ * @brief Get the column number of the XLCellReference.
178
+ * @return The column number.
179
+ */
180
+ uint16_t column() const;
181
+
182
+ /**
183
+ * @brief Set the column number of the XLCellReference.
184
+ * @param column The column number.
185
+ */
186
+ void setColumn(uint16_t column);
187
+
188
+ /**
189
+ * @brief Set both row and column number of the XLCellReference.
190
+ * @param row The row number.
191
+ * @param column The column number.
192
+ */
193
+ void setRowAndColumn(uint32_t row, uint16_t column);
194
+
195
+ /**
196
+ * @brief Get the address of the XLCellReference
197
+ * @return The address, e.g. 'A1'
198
+ */
199
+ std::string address() const;
200
+
201
+ /**
202
+ * @brief Set the address of the XLCellReference
203
+ * @param address The address, e.g. 'A1'
204
+ * @pre The address input string must be a valid Excel cell reference. Otherwise the behaviour is undefined.
205
+ */
206
+ void setAddress(const std::string& address);
207
+
208
+ //----------------------------------------------------------------------------------------------------------------------
209
+ // Private Member Functions
210
+ //----------------------------------------------------------------------------------------------------------------------
211
+
212
+ // private:
213
+
214
+ /**
215
+ * @brief
216
+ * @param row
217
+ * @return
218
+ */
219
+ static std::string rowAsString(uint32_t row);
220
+
221
+ /**
222
+ * @brief
223
+ * @param row
224
+ * @return
225
+ */
226
+ static uint32_t rowAsNumber(const std::string& row);
227
+
228
+ /**
229
+ * @brief Static helper function to convert column number to column letter (e.g. column 1 becomes 'A')
230
+ * @param column The column number.
231
+ * @return The column letter
232
+ */
233
+ static std::string columnAsString(uint16_t column);
234
+
235
+ /**
236
+ * @brief Static helper function to convert column letter to column number (e.g. column 'A' becomes 1)
237
+ * @param column The column letter, e.g. 'A'
238
+ * @return The column number.
239
+ */
240
+ static uint16_t columnAsNumber(const std::string& column);
241
+
242
+ /**
243
+ * @brief Static helper function to convert cell address to coordinates.
244
+ * @param address The address to be converted, e.g. 'A1'
245
+ * @return A std::pair<row, column>
246
+ */
247
+ static XLCoordinates coordinatesFromAddress(const std::string& address);
248
+
249
+ //----------------------------------------------------------------------------------------------------------------------
250
+ // Private Member Variables
251
+ //----------------------------------------------------------------------------------------------------------------------
252
+ private:
253
+ uint32_t m_row { 1 }; /**< The row */
254
+ uint16_t m_column { 1 }; /**< The column */
255
+ std::string m_cellAddress { "A1" }; /**< The address, e.g. 'A1' */
256
+ };
257
+
258
+ /**
259
+ * @brief Helper function to check equality between two XLCellReferences.
260
+ * @param lhs The first XLCellReference
261
+ * @param rhs The second XLCellReference
262
+ * @return true if equal; otherwise false.
263
+ */
264
+ inline bool operator==(const XLCellReference& lhs, const XLCellReference& rhs)
265
+ {
266
+ return lhs.row() == rhs.row() && lhs.column() == rhs.column();
267
+ }
268
+
269
+ /**
270
+ * @brief Helper function to check for in-equality between two XLCellReferences
271
+ * @param lhs The first XLCellReference
272
+ * @param rhs The second XLCellReference
273
+ * @return false if equal; otherwise true.
274
+ */
275
+ inline bool operator!=(const XLCellReference& lhs, const XLCellReference& rhs) { return !(lhs == rhs); }
276
+
277
+ /**
278
+ * @brief Helper function to check if one XLCellReference is smaller than another.
279
+ * @param lhs The first XLCellReference
280
+ * @param rhs The second XLCellReference
281
+ * @return true if lhs < rhs; otherwise false.
282
+ */
283
+ inline bool operator<(const XLCellReference& lhs, const XLCellReference& rhs)
284
+ {
285
+ return lhs.row() < rhs.row() || (lhs.row() <= rhs.row() && lhs.column() < rhs.column());
286
+ }
287
+
288
+ /**
289
+ * @brief Helper function to check if one XLCellReference is larger than another.
290
+ * @param lhs The first XLCellReference
291
+ * @param rhs The second XLCellReference
292
+ * @return true if lhs > rhs; otherwise false.
293
+ */
294
+ inline bool operator>(const XLCellReference& lhs, const XLCellReference& rhs) { return (rhs < lhs); }
295
+
296
+ /**
297
+ * @brief Helper function to check if one XLCellReference is smaller than or equal to another.
298
+ * @param lhs The first XLCellReference
299
+ * @param rhs The second XLCellReference
300
+ * @return true if lhs <= rhs; otherwise false
301
+ */
302
+ inline bool operator<=(const XLCellReference& lhs, const XLCellReference& rhs) { return !(lhs > rhs); }
303
+
304
+ /**
305
+ * @brief Helper function to check if one XLCellReference is larger than or equal to another.
306
+ * @param lhs The first XLCellReference
307
+ * @param rhs The second XLCellReference
308
+ * @return true if lhs >= rhs; otherwise false.
309
+ */
310
+ inline bool operator>=(const XLCellReference& lhs, const XLCellReference& rhs) { return !(lhs < rhs); }
311
+ } // namespace OpenXLSX
312
+
313
+ #ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
314
+ # pragma warning(pop)
315
+ #endif // _MSC_VER
316
+
317
+ #endif // OPENXLSX_XLCELLREFERENCE_HPP