xtd 0.2.0
Loading...
Searching...
No Matches
property.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../../object.hpp"
6#include "../../string.hpp"
7#include "../../single.hpp"
8#include <ostream>
9
11namespace xtd {
12 namespace web {
13 namespace css {
14 class property : public object {
15 public:
17
19 property() = default;
20 explicit property(const xtd::string& value) : value_(value) {}
21 property(const property&) = default;
22 property& operator =(const property&) = default;
23 property(property&&) = default;
24 property& operator =(property&&) = default;
26
28
30 operator xtd::string() noexcept {return value_;}
32
34
36 [[nodiscard]] auto value() const noexcept -> const xtd::string& {return value_;}
37 template<class value_t>
38 [[nodiscard]] auto value() const noexcept -> value_t {return xtd::parse<value_t>(value_);}
40
42
44 [[nodiscard]] auto to_boolean() const -> bool {return xtd::parse<bool>(value_);}
45 [[nodiscard]] auto to_double() const -> double {return xtd::parse<double>(value_);}
46 [[nodiscard]] auto to_int8() const -> xtd::sbyte {return xtd::parse<xtd::sbyte>(value_);}
47 [[nodiscard]] auto to_int16() const -> xtd::int16 {return xtd::parse<xtd::int16>(value_);}
48 [[nodiscard]] auto to_int32() const -> xtd::int32 {return xtd::parse<xtd::int32>(value_);}
49 [[nodiscard]] auto to_int64() const -> xtd::int64 {return xtd::parse<xtd::int64>(value_);}
50 [[nodiscard]] auto to_intptr() const -> xtd::intptr {return xtd::parse<xtd::intptr>(value_);}
51 [[nodiscard]] auto to_single() const -> xtd::single {return xtd::parse<float>(value_);}
52 [[nodiscard]] auto to_string() const noexcept -> xtd::string override {return value_;}
53 [[nodiscard]] auto to_uint8() const -> xtd::byte {return xtd::parse<xtd::byte>(value_);}
54 [[nodiscard]] auto to_uint16() const -> xtd::uint16 {return xtd::parse<xtd::uint16>(value_);}
55 [[nodiscard]] auto to_uint32() const -> xtd::uint32 {return xtd::parse<xtd::uint32>(value_);}
56 [[nodiscard]] auto to_uint64() const -> xtd::uint64 {return xtd::parse<xtd::uint64>(value_);}
57 [[nodiscard]] auto to_uintptr() const -> xtd::uintptr {return xtd::parse<xtd::uintptr>(value_);}
58 template<class value_t>
59 [[nodiscard]] auto to() const -> value_t {return xtd::parse<value_t>(value_);}
61
63
65 static auto from(bool value) -> property {return property(string::format("{}", value));}
66 static auto from(double value) -> property {return property(string::format("{}", value));}
67 static auto from(xtd::single value) -> property {return property(string::format("{}", value));}
68 static auto from(xtd::sbyte value) -> property {return property(string::format("{}", value));}
69 static auto from(xtd::int16 value) -> property {return property(string::format("{}", value));}
70 static auto from(xtd::int32 value) -> property {return property(string::format("{}", value));}
71 static auto from(xtd::int64 value) -> property {return property(string::format("{}", value));}
72 static auto from(const xtd::string& value) -> property {return property(string::format("{}", value));}
73 static auto from(xtd::byte value) -> property {return property(string::format("{}", value));}
74 static auto from(xtd::uint16 value) -> property {return property(string::format("{}", value));}
75 static auto from(xtd::uint32 value) -> property {return property(string::format("{}", value));}
76 static auto from(xtd::uint64 value) -> property {return property(string::format("{}", value));}
77 static auto from(const auto& value) -> property {return property(string::format("{}", value));}
79
80 private:
81 xtd::string value_;
82 };
83 }
84 }
85}
object()=default
Create a new instance of the ultimate base class object.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
Definition property.hpp:52
static auto format(const basic_string< char > &fmt, args_t &&... args) -> basic_string
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.hpp:23
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
uintmax_t uintptr
Represent a pointer or a handle.
Definition uintptr.hpp:23
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
std::int16_t int16
Represents a 16-bit signed integer.
Definition int16.hpp:23
std::uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.hpp:23
std::uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
float single
Represents a single-precision floating-point number.
Definition single.hpp:23
double parse< double >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.hpp:208
bool parse< bool >(const std::string &str)
Convert a string into a type.
Definition parse.hpp:370
xtd::sbyte parse< xtd::sbyte >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.hpp:91
float parse< float >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.hpp:190
value_t parse(const std::string &str)
Convert a string into a type.
Definition parse.hpp:34
Contains classes and interfaces that enable browser-server communication. This namespace includes the...
Definition css_reader.hpp:14
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::object class.
Contains xtd::single type.
Contains xtd::string alias.