xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.core
include
xtd
internal
__print.hpp
Go to the documentation of this file.
1
4
5
#pragma once
7
#if !defined(__XTD_CORE_INTERNAL__)
8
#error "Do not include this file: Internal use only"
9
#endif
11
12
#include <cstdio>
13
#include <ostream>
14
#include "
../environment.hpp
"
15
17
inline
auto
__xtd_print_with_file_write__(
bool
new_line, FILE* file,
xtd::string
&& s) ->
void
{
18
if
(!file)
xtd::helpers::throw_helper::throws
(
xtd::helpers::exception_case::null_pointer
);
19
if
(new_line)
s
+=
xtd::environment::new_line
();
20
if
(fwrite(
s
.chars().c_str(), 1,
s
.length(), file) !=
s
.length())
21
xtd::helpers::throw_helper::throws
(
xtd::helpers::exception_case::io
);
22
}
23
24
inline
auto
__xtd_print_with_ostream_write__(
bool
new_line, std::ostream& os,
xtd::string
&& s) ->
void
{
25
if
(!os.good())
xtd::helpers::throw_helper::throws
(
xtd::helpers::exception_case::io
);
26
if
(new_line)
s
+=
xtd::environment::new_line
();
27
os.write(
s
.chars().c_str(),
s
.length());
28
}
xtd::environment::new_line
static auto new_line() noexcept -> xtd::string
Gets the newline string defined for this environment.
xtd::helpers::throw_helper::throws
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
environment.hpp
Contains xtd::environment class.
xtd::helpers::exception_case::null_pointer
@ null_pointer
The pointer is null.
Definition
exception_case.hpp:79
xtd::helpers::exception_case::io
@ io
I/O erreror occurs.
Definition
exception_case.hpp:69
xtd::string
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition
__string_definitions.hpp:43
xtd::console_key::s
@ s
The S key.
Definition
console_key.hpp:124
Generated on
for xtd by
Gammasoft
. All rights reserved.