VTK  9.4.20241218
vtkTextCodec.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
21#ifndef vtkTextCodec_h
22#define vtkTextCodec_h
23
24#include "vtkIOCoreModule.h" // For export macro
25#include "vtkObject.h"
26
27VTK_ABI_NAMESPACE_BEGIN
28class VTKIOCORE_EXPORT vtkTextCodec : public vtkObject
29{
30public:
31 vtkTypeMacro(vtkTextCodec, vtkObject);
32
34
38 virtual const char* Name();
39 void PrintSelf(ostream& os, vtkIndent indent) override;
41
42 virtual bool CanHandle(const char* NameString);
43
47 virtual bool IsValid(istream& InputStream);
48
50
57 {
58 public:
59 virtual OutputIterator& operator++(int) { return *this; }
60 virtual OutputIterator& operator*() { return *this; }
61 virtual OutputIterator& operator=(const vtkTypeUInt32& value) = 0;
62
63 OutputIterator() = default;
64 virtual ~OutputIterator() = default;
65
66 private:
67 OutputIterator(const OutputIterator&) = delete;
68 OutputIterator& operator=(const OutputIterator&) = delete;
69 };
71
77 virtual void ToUnicode(istream& inputStream, vtkTextCodec::OutputIterator& output);
78
83 std::string ToString(istream& inputStream);
84
90 virtual vtkTypeUInt32 NextUTF32CodePoint(istream& inputStream) = 0;
91
92protected:
94 ~vtkTextCodec() override;
95
96private:
97 vtkTextCodec(const vtkTextCodec&) = delete;
98 void operator=(const vtkTextCodec&) = delete;
99};
100
101VTK_ABI_NAMESPACE_END
102#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
a base class that any output iterators need to derive from to use the first signature of to_unicode.
virtual OutputIterator & operator=(const vtkTypeUInt32 &value)=0
virtual OutputIterator & operator++(int)
virtual ~OutputIterator()=default
virtual OutputIterator & operator*()
Virtual class to act as an interface for all text codecs.
virtual vtkTypeUInt32 NextUTF32CodePoint(istream &inputStream)=0
Return the next code point from the sequence represented by the stream advancing the stream through h...
virtual const char * Name()
The name this codec goes by - should match the string the factory will take to create it.
std::string ToString(istream &inputStream)
Convenience method to take data from the stream and put it into a string.
virtual bool CanHandle(const char *NameString)
~vtkTextCodec() override
void PrintSelf(ostream &os, vtkIndent indent) override
The name this codec goes by - should match the string the factory will take to create it.
virtual bool IsValid(istream &InputStream)
is the given sample valid for this codec? The stream will not be advanced.
virtual void ToUnicode(istream &inputStream, vtkTextCodec::OutputIterator &output)
Iterate through the sequence represented by the stream assigning the result to the output iterator.