Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
3bca295b
Commit
3bca295b
authored
Oct 13, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add constructors and assign operators
parent
ffb044f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
38 deletions
+38
-38
libcaf_io/caf/io/uri.hpp
libcaf_io/caf/io/uri.hpp
+29
-19
libcaf_io/src/uri.cpp
libcaf_io/src/uri.cpp
+9
-19
No files found.
libcaf_io/caf/io/uri.hpp
View file @
3bca295b
...
@@ -32,16 +32,12 @@
...
@@ -32,16 +32,12 @@
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
namespace
detail
{
class
uri_private
;
class
uri_private
;
void
intrusive_ptr_add_ref
(
uri_private
*
p
);
void
intrusive_ptr_add_ref
(
uri_private
*
p
);
void
intrusive_ptr_release
(
uri_private
*
p
);
void
intrusive_ptr_release
(
uri_private
*
p
);
}
// namespace detail
namespace
{
namespace
{
using
str_bounds
=
std
::
pair
<
std
::
string
::
iterator
,
std
::
string
::
iterator
>
;
using
str_bounds
=
std
::
pair
<
std
::
string
::
iterator
,
std
::
string
::
iterator
>
;
...
@@ -72,8 +68,7 @@ public:
...
@@ -72,8 +68,7 @@ public:
// treat a NULL string like an empty string
// treat a NULL string like an empty string
return
(
what
)
?
str
().
compare
(
what
)
:
str
().
compare
(
""
);
return
(
what
)
?
str
().
compare
(
what
)
:
str
().
compare
(
""
);
}
}
///
///
/// @brief Create an empty URI.
/// @brief Create an empty URI.
///
///
...
@@ -85,8 +80,30 @@ public:
...
@@ -85,8 +80,30 @@ public:
/// @note {@link caf::io::uri uri} is implicit shared, thus copy
/// @note {@link caf::io::uri uri} is implicit shared, thus copy
/// operations are very fast and lightweight.
/// operations are very fast and lightweight.
///
///
uri
(
const
uri
&
other
);
uri
(
const
uri
&
other
)
=
default
;
///
/// @brief Create this object from @p other.
/// @param other The original {@link caf::io::uri uri} object.
/// @note {@link caf::io::uri uri} is implicit shared, thus copy
/// operations are very fast and lightweight.
///
uri
(
uri
&&
other
)
=
default
;
///
/// @brief Copy assigment from @p other.
/// @param other Original {@link caf::io::uri uri} object.
/// @returns <code>*this</code>.
///
uri
&
operator
=
(
const
uri
&
other
)
=
default
;
///
/// @brief Move assignment from @p other;
/// @param other Original {@link caf::io::uri uri} object.
/// @return <code>*this</code>.
///
uri
&
operator
=
(
uri
&&
other
)
=
default
;
///
///
/// @brief Create an URI from @p uri_str.
/// @brief Create an URI from @p uri_str.
///
///
...
@@ -101,7 +118,7 @@ public:
...
@@ -101,7 +118,7 @@ public:
/// (e.g. "Hello World" is a string, but is an invalid URI).
/// (e.g. "Hello World" is a string, but is an invalid URI).
///
///
static
optional
<
uri
>
make
(
const
std
::
string
&
uri_str
);
static
optional
<
uri
>
make
(
const
std
::
string
&
uri_str
);
///
///
/// @brief Create an URI from @p uri_str_c_str.
/// @brief Create an URI from @p uri_str_c_str.
/// @param uri_c_str An URI encoded as a C-string.
/// @param uri_c_str An URI encoded as a C-string.
...
@@ -251,13 +268,6 @@ public:
...
@@ -251,13 +268,6 @@ public:
///
///
void
swap
(
uri
&
other
);
void
swap
(
uri
&
other
);
///
/// @brief Equivalent to <code>uri(other).swap(*this)</code>.
/// @param other Original {@link caf::io::uri uri} object.
/// @returns <code>*this</code>.
///
uri
&
operator
=
(
const
uri
&
other
);
/// @cond private
/// @cond private
template
<
class
Inspector
>
template
<
class
Inspector
>
...
@@ -268,9 +278,9 @@ public:
...
@@ -268,9 +278,9 @@ public:
/// @endcond
/// @endcond
private:
private:
uri
(
detail
::
uri_private
*
d
);
uri
(
uri_private
*
d
);
intrusive_ptr
<
detail
::
uri_private
>
d_
;
intrusive_ptr
<
uri_private
>
d_
;
};
};
}
// namespace io
}
// namespace io
...
...
libcaf_io/src/uri.cpp
View file @
3bca295b
...
@@ -44,7 +44,6 @@ using str_bounds = std::pair<std::string::iterator, std::string::iterator>;
...
@@ -44,7 +44,6 @@ using str_bounds = std::pair<std::string::iterator, std::string::iterator>;
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
namespace
detail
{
class
uri_private
:
public
ref_counted
{
class
uri_private
:
public
ref_counted
{
friend
optional
<
uri
>
uri
::
make
(
const
string
&
uri_str
);
friend
optional
<
uri
>
uri
::
make
(
const
string
&
uri_str
);
...
@@ -206,7 +205,7 @@ public:
...
@@ -206,7 +205,7 @@ public:
inline
const
str_bounds
&
port
()
const
{
return
m_port_
;
}
inline
const
str_bounds
&
port
()
const
{
return
m_port_
;
}
inline
uint16_t
port_as_int
()
const
{
return
m_int_port_
;
}
inline
uint16_t
port_as_int
()
const
{
return
m_int_port_
;
}
inline
const
str_bounds
&
user_information
()
const
{
inline
const
str_bounds
&
user_information
()
const
{
return
m_user_information_
;
return
m_user_information_
;
}
}
...
@@ -229,20 +228,19 @@ void intrusive_ptr_release(uri_private* p) {
...
@@ -229,20 +228,19 @@ void intrusive_ptr_release(uri_private* p) {
}
}
namespace
{
namespace
{
intrusive_ptr
<
uri_private
>
m_default_uri_private
(
new
uri_private
);
intrusive_ptr
<
uri_private
>
m_default_uri_private
(
new
uri_private
);
}
// namespace <anonymous>
}
// namespace <anonymous>
}
// namespace detail
}
// namespace io
}
// namespace io
}
// namespace caf
}
// namespace caf
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
optional
<
uri
>
uri
::
make
(
const
string
&
uri_str
)
{
optional
<
uri
>
uri
::
make
(
const
string
&
uri_str
)
{
detail
::
uri_private
*
result
=
new
detail
::
uri_private
;
uri_private
*
result
=
new
uri_private
;
if
(
result
->
parse_uri
(
uri_str
))
if
(
result
->
parse_uri
(
uri_str
))
return
uri
{
result
};
return
uri
{
result
};
else
{
else
{
...
@@ -256,22 +254,14 @@ optional<uri> uri::make(const char* cstr) {
...
@@ -256,22 +254,14 @@ optional<uri> uri::make(const char* cstr) {
return
make
(
tmp
);
return
make
(
tmp
);
}
}
uri
::
uri
()
:
d_
(
detail
::
m_default_uri_private
)
{
uri
::
uri
()
:
d_
(
m_default_uri_private
)
{
// nop
// nop
}
}
uri
::
uri
(
detail
::
uri_private
*
d
)
:
d_
(
d
)
{
uri
::
uri
(
uri_private
*
d
)
:
d_
(
d
)
{
// nop
}
uri
::
uri
(
const
uri
&
other
)
:
d_
(
other
.
d_
)
{
// nop
// nop
}
}
uri
&
uri
::
operator
=
(
const
uri
&
other
)
{
d_
=
other
.
d_
;
return
*
this
;
}
const
string
&
uri
::
str
()
const
{
const
string
&
uri
::
str
()
const
{
return
d_
->
as_string
();
return
d_
->
as_string
();
...
...
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