Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
c494c980
Commit
c494c980
authored
Jul 01, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean.
parent
b827a97f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
30 deletions
+23
-30
format.h
format.h
+23
-30
No files found.
format.h
View file @
c494c980
...
...
@@ -56,11 +56,10 @@
# define FMT_GCC_EXTENSION
#endif
#if
defined(__GNUC_LIBSTD__) && defined (__GNUC_LIBSTD_MINOR__)
#if
def __GNUC_LIBSTD__
# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
#endif
// Compatibility with compilers other than clang.
#ifdef __has_feature
# define FMT_HAS_FEATURE(x) __has_feature(x)
#else
...
...
@@ -73,19 +72,13 @@
# define FMT_HAS_BUILTIN(x) 0
#endif
#ifdef _MSC_VER
# define FMT_MSC_VER _MSC_VER
#else
# define FMT_MSC_VER 0
#endif
#ifndef FMT_USE_VARIADIC_TEMPLATES
// Variadic templates are available in GCC since version 4.4
// (http://gcc.gnu.org/projects/cxx0x.html) and in Visual C++
// since version 2013.
# define FMT_USE_VARIADIC_TEMPLATES \
(FMT_HAS_FEATURE(cxx_variadic_templates) || \
(FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) ||
FMT
_MSC_VER >= 1800)
(FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) || _MSC_VER >= 1800)
#endif
#ifndef FMT_USE_RVALUE_REFERENCES
...
...
@@ -96,7 +89,7 @@
# else
# define FMT_USE_RVALUE_REFERENCES \
(FMT_HAS_FEATURE(cxx_rvalue_references) || \
(FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) ||
FMT
_MSC_VER >= 1600)
(FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) || _MSC_VER >= 1600)
# endif
#endif
...
...
@@ -104,7 +97,7 @@
# include <utility> // for std::move
#endif
// Define FMT_USE_NOEXCEPT to make
f
ormat use noexcept (C++11 feature).
// Define FMT_USE_NOEXCEPT to make
C++ F
ormat use noexcept (C++11 feature).
#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
(FMT_GCC_VERSION >= 408 && __cplusplus >= 201103)
# define FMT_NOEXCEPT(expr) noexcept(expr)
...
...
@@ -171,8 +164,8 @@ class BasicStringRef {
public:
/**
Constructs a string reference object from a C string and a size.
If *size* is zero, which is the default, the size is computed
with
`strlen`
.
If *size* is zero, which is the default, the size is computed
automatically
.
*/
BasicStringRef
(
const
Char
*
s
,
std
::
size_t
size
=
0
)
:
data_
(
s
),
size_
(
size
)
{}
...
...
@@ -242,10 +235,10 @@ class Array {
T
*
ptr_
;
T
data_
[
SIZE
];
void
G
row
(
std
::
size_t
size
);
void
g
row
(
std
::
size_t
size
);
// Free memory allocated by the array.
void
F
ree
()
{
void
f
ree
()
{
if
(
ptr_
!=
data_
)
delete
[]
ptr_
;
}
...
...
@@ -268,7 +261,7 @@ class Array {
public:
Array
()
:
size_
(
0
),
capacity_
(
SIZE
),
ptr_
(
data_
)
{}
~
Array
()
{
F
ree
();
}
~
Array
()
{
f
ree
();
}
#if FMT_USE_RVALUE_REFERENCES
Array
(
Array
&&
other
)
{
...
...
@@ -277,7 +270,7 @@ class Array {
Array
&
operator
=
(
Array
&&
other
)
{
assert
(
this
!=
&
other
);
F
ree
();
f
ree
();
move
(
other
);
return
*
this
;
}
...
...
@@ -292,21 +285,21 @@ class Array {
// Resizes the array. If T is a POD type new elements are not initialized.
void
resize
(
std
::
size_t
new_size
)
{
if
(
new_size
>
capacity_
)
G
row
(
new_size
);
g
row
(
new_size
);
size_
=
new_size
;
}
// Reserves space to store at least capacity elements.
void
reserve
(
std
::
size_t
capacity
)
{
if
(
capacity
>
capacity_
)
G
row
(
capacity
);
g
row
(
capacity
);
}
void
clear
()
{
size_
=
0
;
}
void
push_back
(
const
T
&
value
)
{
if
(
size_
==
capacity_
)
G
row
(
size_
+
1
);
g
row
(
size_
+
1
);
ptr_
[
size_
++
]
=
value
;
}
...
...
@@ -318,7 +311,7 @@ class Array {
};
template
<
typename
T
,
std
::
size_t
SIZE
>
void
Array
<
T
,
SIZE
>::
G
row
(
std
::
size_t
size
)
{
void
Array
<
T
,
SIZE
>::
g
row
(
std
::
size_t
size
)
{
capacity_
=
(
std
::
max
)(
size
,
capacity_
+
capacity_
/
2
);
T
*
p
=
new
T
[
capacity_
];
std
::
copy
(
ptr_
,
ptr_
+
size_
,
CheckPtr
(
p
,
capacity_
));
...
...
@@ -331,7 +324,7 @@ template <typename T, std::size_t SIZE>
void
Array
<
T
,
SIZE
>::
append
(
const
T
*
begin
,
const
T
*
end
)
{
std
::
ptrdiff_t
num_elements
=
end
-
begin
;
if
(
size_
+
num_elements
>
capacity_
)
G
row
(
size_
+
num_elements
);
g
row
(
size_
+
num_elements
);
std
::
copy
(
begin
,
end
,
CheckPtr
(
ptr_
,
capacity_
)
+
size_
);
size_
+=
num_elements
;
}
...
...
@@ -342,9 +335,6 @@ struct StringValue {
std
::
size_t
size
;
};
template
<
typename
Char
>
class
CharTraits
;
template
<
typename
Char
>
class
BasicCharTraits
{
public:
...
...
@@ -355,6 +345,9 @@ class BasicCharTraits {
#endif
};
template
<
typename
Char
>
class
CharTraits
;
template
<
>
class
CharTraits
<
char
>
:
public
BasicCharTraits
<
char
>
{
private:
...
...
@@ -714,9 +707,9 @@ class MakeArg : public internal::ArgInfo {
}
};
class
SystemErrorBase
:
public
std
::
runtime_error
{
public
:
SystemErrorBase
()
:
std
::
runtime_error
(
""
)
{}
class
RuntimeError
:
public
std
::
runtime_error
{
protected
:
RuntimeError
()
:
std
::
runtime_error
(
""
)
{}
};
}
// namespace internal
...
...
@@ -728,7 +721,7 @@ class ArgList {
const
internal
::
ArgInfo
*
args_
;
std
::
size_t
size_
;
public:
public:
ArgList
()
:
size_
(
0
)
{}
ArgList
(
const
internal
::
ArgInfo
*
args
,
std
::
size_t
size
)
:
args_
(
args
),
size_
(
size
)
{}
...
...
@@ -1102,7 +1095,7 @@ inline StrFormatSpec<wchar_t> pad(
An error returned by an operating system or a language runtime,
for example a file opening error.
*/
class
SystemError
:
public
internal
::
SystemErrorBase
{
class
SystemError
:
public
internal
::
RuntimeError
{
private:
void
init
(
int
error_code
,
StringRef
format_str
,
const
ArgList
&
args
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment