xtd 0.2.0
Loading...
Searching...
No Matches
property.h
Go to the documentation of this file.
1
4#pragma once
5#include "../../object.h"
6#include "../../string.h"
7#include <ostream>
8
10namespace xtd {
11 namespace web {
12 namespace css {
13 class property : public object {
14 public:
16
18 property() = default;
19 explicit property(const xtd::string& value) : value_(value) {}
21
23
25 operator xtd::string() noexcept {return value_;}
27
29
31 const xtd::string& value() const noexcept {return value_;}
32 template<typename value_t>
33 uintptr value() const noexcept {return xtd::parse<value_t>(value_);}
35
37
39 bool to_boolean() const {return xtd::parse<bool>(value_);}
40 double to_double() const {return xtd::parse<double>(value_);}
41 sbyte to_int8() const {return xtd::parse<sbyte>(value_);}
42 int16 to_int16() const {return xtd::parse<int16>(value_);}
43 int32 to_int32() const {return xtd::parse<int32>(value_);}
44 int64 to_int64() const {return xtd::parse<int64>(value_);}
45 intptr to_intptr() const {return xtd::parse<intptr>(value_);}
46 float to_single() const {return xtd::parse<float>(value_);}
47 xtd::string to_string() const noexcept override {return value_;}
48 xtd::byte to_uint8() const {return xtd::parse<xtd::byte>(value_);}
49 uint16 to_uint16() const {return xtd::parse<uint16>(value_);}
50 uint32 to_uint32() const {return xtd::parse<uint32>(value_);}
51 uint64 to_uint64() const {return xtd::parse<uint64>(value_);}
52 uintptr to_uintptr() const {return xtd::parse<uintptr>(value_);}
53 template<typename value_t>
54 uintptr to() const {return xtd::parse<value_t>(value_);}
56
58
60 static property from(bool value) {return property(string::format("{}", value));}
61 static property from(double value) {return property(string::format("{}", value));}
62 static property from(float value) {return property(string::format("{}", value));}
63 static property from(sbyte value) {return property(string::format("{}", value));}
64 static property from(int16 value) {return property(string::format("{}", value));}
65 static property from(int32 value) {return property(string::format("{}", value));}
66 static property from(int64 value) {return property(string::format("{}", value));}
67 static property from(const xtd::string& value) {return property(string::format("{}", value));}
68 static property from(xtd::byte value) {return property(string::format("{}", value));}
69 static property from(uint16 value) {return property(string::format("{}", value));}
70 static property from(uint32 value) {return property(string::format("{}", value));}
71 static property from(uint64 value) {return property(string::format("{}", value));}
72 template<typename value_t>
73 static property from(value_t value) {return property(string::format("{}", value));}
75
76 private:
77 xtd::string value_;
78 };
79 }
80 }
81}
Represents text as a sequence of character units.
Definition basic_string.h:79
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Definition property.h:13
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
Definition property.h:47
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.h:43
int16_t int16
Represents a 16-bit signed integer.
Definition int16.h:23
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.h:23
int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.h:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
uintmax_t uintptr
Represent a pointer or a handle.
Definition uintptr.h:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.h:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.h:23
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.h:23
double parse< double >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.h:209
bool parse< bool >(const std::string &str)
Convert a string into a type.
Definition parse.h:371
float parse< float >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.h:191
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10