xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
string_format.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <ostream>
7 #include <xtd/object.h>
8 #include "../drawing_export.h"
9 #include "hotkey_prefix.h"
10 #include "string_alignment.h"
11 #include "string_format_flags.h"
12 #include "string_trimming.h"
13 
15 namespace xtd {
17  namespace drawing {
25  class drawing_export_ string_format final : public object {
26  public:
33  string_format() = default;
34 
37  string_format(const xtd::drawing::string_format& format) = default;
38 
41  explicit string_format(xtd::drawing::string_format_flags options) : format_flags_(options) {}
42 
56  return format;
57  }
58 
70 
74  xtd::drawing::string_alignment alignment() const {return alignment_;}
79  alignment_ = alignment;
80  return *this;
81  }
82 
85  xtd::drawing::string_format_flags format_flags() const {return format_flags_;}
89  format_flags_ = format_flag;
90  return *this;
91  }
92 
96  xtd::drawing::hotkey_prefix hotkey_prefix() const {return hotkey_prefix_;}
101  hotkey_prefix_ = hotkey_prefix;
102  return *this;
103  }
104 
108  xtd::drawing::string_alignment line_alignment() const {return line_alignment_;}
113  line_alignment_ = line_alignment;
114  return *this;
115  }
116 
119  xtd::drawing::string_trimming trimming() const {return trimming_;}
123  trimming_ = trimming;
124  return *this;
125  }
126 
127  private:
133  };
134  }
135 }
Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulat...
Definition: string_format.h:25
static xtd::drawing::string_format generic_typographic()
Gets a generic typographic string_format object.
Definition: string_format.h:69
xtd::drawing::string_format & format_flags(xtd::drawing::string_format_flags format_flag)
Sets a string_formatFlags enumeration that contains formatting information.
Definition: string_format.h:88
static xtd::drawing::string_format generic_default()
Gets a generic default string_format object.
Definition: string_format.h:53
xtd::drawing::string_alignment line_alignment() const
Gets vertical alignment of the string.
Definition: string_format.h:108
xtd::drawing::string_format & alignment(xtd::drawing::string_alignment alignment)
Sets horizontal alignment of the string.
Definition: string_format.h:78
xtd::drawing::string_alignment alignment() const
Gets horizontal alignment of the string.
Definition: string_format.h:74
xtd::drawing::string_format & line_alignment(xtd::drawing::string_alignment line_alignment)
Sets vertical alignment of the string.
Definition: string_format.h:112
string_format()=default
Initializes a new string_format object.
string_format(xtd::drawing::string_format_flags options)
Initializes a new string_format object with the specified string_format_flags enumeration.
Definition: string_format.h:41
string_format(const xtd::drawing::string_format &format)=default
Initializes a new string_format object from the specified existing string_format object.
xtd::drawing::hotkey_prefix hotkey_prefix() const
Gets the HotkeyPrefix object for this string_format object.
Definition: string_format.h:96
xtd::drawing::string_format & hotkey_prefix(xtd::drawing::hotkey_prefix hotkey_prefix)
Sets the HotkeyPrefix object for this string_format object.
Definition: string_format.h:100
xtd::drawing::string_format_flags format_flags() const
Gets a string_formatFlags enumeration that contains formatting information.
Definition: string_format.h:85
xtd::drawing::string_trimming trimming() const
Gets the string_trimming enumeration for this string_format object.
Definition: string_format.h:119
xtd::drawing::string_format & trimming(xtd::drawing::string_trimming trimming)
Sets the string_trimming enumeration for this string_format object.
Definition: string_format.h:122
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
#define drawing_export_
Define shared library export.
Definition: drawing_export.h:13
string_trimming
Specifies how to trim characters from a string that does not completely fit into a layout shape.
Definition: string_trimming.h:17
hotkey_prefix
Specifies the type of display for hot-key prefixes that relate to text.
Definition: hotkey_prefix.h:18
string_format_flags
Specifies the display and layout information for text strings. This enumeration allows a bitwise comb...
Definition: string_format_flags.h:17
string_alignment
Specifies the alignment of a text string relative to its layout rectangle.
Definition: string_alignment.h:23
@ none
Specifies no trimming.
@ character
Specifies that the text is trimmed to the nearest character.
@ none
No hot-key prefix.
@ line_limit
Only entire lines are laid out in the formatting rectangle. By default layout continues until the end...
@ fit_black_box
Parts of characters are allowed to overhang the string's layout rectangle. By default,...
@ no_clip
Overhanging parts of glyphs, and unwrapped text reaching outside the formatting rectangle are allowed...
@ near
Specifies the text be aligned near the layout. In a left-to-right layout, the near position is left....
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::object class.
Contains xtd::drawing::string_alignment enum class.
Contains xtd::drawing::string_format_flags enum class.
Contains xtd::drawing::string_trimming enum class.
Contains xtd::drawing::text::hotkey_prefix enum class.