Line |
Branch |
Exec |
Source |
1 |
|
|
// SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH |
2 |
|
|
// |
3 |
|
|
// SPDX-License-Identifier: MIT |
4 |
|
|
|
5 |
|
|
#pragma once |
6 |
|
|
|
7 |
|
|
#include <string> |
8 |
|
|
|
9 |
|
|
namespace imgdoc2 |
10 |
|
|
{ |
11 |
|
|
/// This interface gathers all parameters for the operation of "opening an existing file". |
12 |
|
|
class IOpenExistingOptions |
13 |
|
|
{ |
14 |
|
|
public: |
15 |
|
|
/// Sets the filename of the file to be opened. |
16 |
|
|
/// \param filename The null-terminated string specifying the file to be opened. The string |
17 |
|
|
/// is expected to be in UTF8-encoding. |
18 |
|
|
virtual void SetFilename(const char* filename) = 0; |
19 |
|
|
|
20 |
|
|
/// Sets whether the file is to opened as "readonly". |
21 |
|
|
/// \param read_only True file is to opened as "readonly". |
22 |
|
|
virtual void SetOpenReadonly(bool read_only) = 0; |
23 |
|
|
|
24 |
|
|
/// Gets a boolean indicating whether the file is to be opened as "readonly". |
25 |
|
|
/// \returns True if the file is to be opened as "readonly"; false otherwise. |
26 |
|
|
[[nodiscard]] virtual bool GetOpenReadonly() const = 0; |
27 |
|
|
|
28 |
|
|
/// Gets the filename. The string is given in UTF8-encoding. |
29 |
|
|
/// \returns The filename (in UTF8-encoding). |
30 |
|
|
[[nodiscard]] virtual const std::string& GetFilename() const = 0; |
31 |
|
|
|
32 |
|
20 |
virtual ~IOpenExistingOptions() = default; |
33 |
|
|
|
34 |
|
|
/// Sets the filename of the file to be opened. |
35 |
|
|
/// \param filename The null-terminated string specifying the file to be opened. The string |
36 |
|
|
/// is expected to be in UTF8-encoding. |
37 |
|
4 |
void SetFilename(const std::string& filename) |
38 |
|
|
{ |
39 |
|
4 |
this->SetFilename(filename.c_str()); |
40 |
|
4 |
} |
41 |
|
|
|
42 |
|
|
// no copy and no move (-> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-copy-move-or-destructor-function-define-or-delete-them-all ) |
43 |
|
10 |
IOpenExistingOptions() = default; |
44 |
|
|
IOpenExistingOptions(const IOpenExistingOptions&) = delete; // copy constructor |
45 |
|
|
IOpenExistingOptions& operator=(const IOpenExistingOptions&) = delete; // copy assignment |
46 |
|
|
IOpenExistingOptions(IOpenExistingOptions&&) = delete; // move constructor |
47 |
|
|
IOpenExistingOptions& operator=(IOpenExistingOptions&&) = delete; // move assignment |
48 |
|
|
}; |
49 |
|
|
} |
50 |
|
|
|