Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
2557f418
Unverified
Commit
2557f418
authored
Aug 17, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some documentation and cleanup of cif::item
parent
2b92cee3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
24 deletions
+4
-24
include/cif++/item.hpp
+4
-24
No files found.
include/cif++/item.hpp
View file @
2557f418
...
@@ -38,10 +38,8 @@
...
@@ -38,10 +38,8 @@
#include <cif++/text.hpp>
#include <cif++/text.hpp>
/// \file item.hpp
/// \file item.hpp
/// This file contains the declaration of \class item but
/// This file contains the declaration of item but also the item_value and item_handle
/// also the \class item_value and \class item_handle
/// These handle the storage of and access to the data for a single data field.
/// These handle the storage of and access to the data
/// for a single data field.
namespace
cif
namespace
cif
{
{
...
@@ -200,8 +198,7 @@ static_assert(sizeof(item_value) == 24, "sizeof(item_value) should be 24 bytes")
...
@@ -200,8 +198,7 @@ static_assert(sizeof(item_value) == 24, "sizeof(item_value) should be 24 bytes")
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// Transient object to access stored data
// Transient object to access stored data
/// \brief This is \class item_handle, it is used to access
/// \brief This is item_handle, it is used to access the data stored in item_value.
/// the data stored in \class item_value.
struct
item_handle
struct
item_handle
{
{
...
@@ -255,12 +252,10 @@ struct item_handle
...
@@ -255,12 +252,10 @@ struct item_handle
}
}
// We may not have C++20 yet...
// We may not have C++20 yet...
template
<
typename
T
>
template
<
typename
T
>
bool
operator
!=
(
const
T
&
value
)
const
bool
operator
!=
(
const
T
&
value
)
const
{
{
// TODO: icase or not icase?
return
not
operator
==
(
value
);
return
item_value_as
<
T
>::
compare
(
*
this
,
value
,
true
)
!=
0
;
}
}
// empty means either null or unknown
// empty means either null or unknown
...
@@ -426,11 +421,6 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, bool>>>
...
@@ -426,11 +421,6 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, bool>>>
template
<
size_t
N
>
template
<
size_t
N
>
struct
item_handle
::
item_value_as
<
char
[
N
]
>
struct
item_handle
::
item_value_as
<
char
[
N
]
>
{
{
// static std::string_view convert(const item_handle &ref)
// {
// return ref.text();
// }
static
int
compare
(
const
item_handle
&
ref
,
const
char
(
&
value
)[
N
],
bool
icase
)
static
int
compare
(
const
item_handle
&
ref
,
const
char
(
&
value
)[
N
],
bool
icase
)
{
{
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
...
@@ -440,11 +430,6 @@ struct item_handle::item_value_as<char[N]>
...
@@ -440,11 +430,6 @@ struct item_handle::item_value_as<char[N]>
template
<
typename
T
>
template
<
typename
T
>
struct
item_handle
::
item_value_as
<
T
,
std
::
enable_if_t
<
std
::
is_same_v
<
T
,
const
char
*>>>
struct
item_handle
::
item_value_as
<
T
,
std
::
enable_if_t
<
std
::
is_same_v
<
T
,
const
char
*>>>
{
{
// static std::string_view convert(const item_handle &ref)
// {
// return ref.text();
// }
static
int
compare
(
const
item_handle
&
ref
,
const
char
*
value
,
bool
icase
)
static
int
compare
(
const
item_handle
&
ref
,
const
char
*
value
,
bool
icase
)
{
{
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
...
@@ -454,11 +439,6 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, const ch
...
@@ -454,11 +439,6 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, const ch
template
<
typename
T
>
template
<
typename
T
>
struct
item_handle
::
item_value_as
<
T
,
std
::
enable_if_t
<
std
::
is_same_v
<
T
,
std
::
string_view
>>>
struct
item_handle
::
item_value_as
<
T
,
std
::
enable_if_t
<
std
::
is_same_v
<
T
,
std
::
string_view
>>>
{
{
// static std::string_view convert(const item_handle &ref)
// {
// return ref.text();
// }
static
int
compare
(
const
item_handle
&
ref
,
const
std
::
string_view
&
value
,
bool
icase
)
static
int
compare
(
const
item_handle
&
ref
,
const
std
::
string_view
&
value
,
bool
icase
)
{
{
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
return
icase
?
cif
::
icompare
(
ref
.
text
(),
value
)
:
ref
.
text
().
compare
(
value
);
...
...
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