mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge pull request #48 from xpol/add-missing-member-for-workbook
Add implement const version of workbook::get_sheet_by_name().
This commit is contained in:
commit
30275476c1
|
@ -76,6 +76,17 @@ public:
|
|||
TS_ASSERT_EQUALS(new_sheet, found_sheet);
|
||||
}
|
||||
|
||||
void test_get_sheet_by_name_const()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto new_sheet = wb.create_sheet();
|
||||
std::string title = "my sheet";
|
||||
new_sheet.set_title(title);
|
||||
const xlnt::workbook& wbconst = wb;
|
||||
auto found_sheet = wbconst.get_sheet_by_name(title);
|
||||
TS_ASSERT_EQUALS(new_sheet, found_sheet);
|
||||
}
|
||||
|
||||
void test_index_operator() // test_getitem
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
|
|
|
@ -93,7 +93,7 @@ workbook::workbook(encoding e) : workbook()
|
|||
d_->encoding_ = e;
|
||||
}
|
||||
|
||||
worksheet workbook::get_sheet_by_name(const std::string &name)
|
||||
const worksheet workbook::get_sheet_by_name(const std::string &name) const
|
||||
{
|
||||
for (auto &impl : d_->worksheets_)
|
||||
{
|
||||
|
@ -106,6 +106,11 @@ worksheet workbook::get_sheet_by_name(const std::string &name)
|
|||
return worksheet();
|
||||
}
|
||||
|
||||
worksheet workbook::get_sheet_by_name(const std::string &name)
|
||||
{
|
||||
return worksheet(static_cast<const workbook*>(this)->get_sheet_by_name(name));
|
||||
}
|
||||
|
||||
worksheet workbook::get_sheet_by_index(std::size_t index)
|
||||
{
|
||||
return worksheet(&d_->worksheets_[index]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user