Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ cleanup #1927

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@
"unordered_map": "cpp",
"variant": "cpp",
"algorithm": "cpp",
"xtree": "cpp"
"xtree": "cpp",
"execution": "cpp"
},
"C_Cpp.default.cppStandard": "c++20",
"editor.formatOnSave": true
}
"editor.formatOnSave": false
}
4 changes: 2 additions & 2 deletions cpp/include/Ice/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace Ice
* Obtains the Slice type ID of this exception.
* @return The fully-scoped type ID.
*/
static std::string_view ice_staticId();
static std::string_view ice_staticId() noexcept;
};

/**
Expand All @@ -64,7 +64,7 @@ namespace Ice
* Obtains the Slice type ID of this exception.
* @return The fully-scoped type ID.
*/
static std::string_view ice_staticId();
static std::string_view ice_staticId() noexcept;

/// \cond STREAM
virtual void _write(::Ice::OutputStream*) const;
Expand Down
132 changes: 66 additions & 66 deletions cpp/include/Ice/LocalException.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cpp/include/Ice/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace Ice
* Obtains the Slice type ID of this type.
* @return The return value is always "::Ice::Object".
*/
static std::string_view ice_staticId();
static std::string_view ice_staticId() noexcept;

/// \cond INTERNAL
virtual bool _iceDispatch(IceInternal::Incoming&);
Expand Down
52 changes: 27 additions & 25 deletions cpp/include/Ice/Proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ namespace Ice
*/
const Prx* operator->() const { return &asPrx(); }

// We don't provide the non-const operator-> because only the assignment operators can modify the proxy - and
// you shouldn't call operator-> before calling operator=.
// We don't provide the non-const operator-> because only the assignment operators can modify the proxy.

/**
* Obtains a proxy that is identical to this proxy, except for the adapter ID.
* @param id The adapter ID for the new proxy.
* @return A proxy with the new adapter ID.
*/
Prx ice_adapterId(const std::string& id) const { return fromReference(asPrx()._adapterId(id)); }
Prx ice_adapterId(std::string id) const { return fromReference(asPrx()._adapterId(std::move(id))); }

/**
* Obtains a proxy that is identical to this proxy, but uses batch datagram invocations.
Expand Down Expand Up @@ -109,14 +108,14 @@ namespace Ice
* connection ID.
* @return A proxy with the specified connection ID.
*/
Prx ice_connectionId(const ::std::string& id) const { return fromReference(asPrx()._connectionId(id)); }
Prx ice_connectionId(std::string id) const { return fromReference(asPrx()._connectionId(std::move(id))); }

/**
* Obtains a proxy that is identical to this proxy, except for the per-proxy context.
* @param context The context for the new proxy.
* @return A proxy with the new per-proxy context.
*/
Prx ice_context(const ::Ice::Context& context) const { return fromReference(asPrx()._context(context)); }
Prx ice_context(Context context) const { return fromReference(asPrx()._context(std::move(context))); }

/**
* Obtains a proxy that is identical to this proxy, but uses datagram invocations.
Expand All @@ -130,17 +129,17 @@ namespace Ice
* @param version The encoding version to use to marshal request parameters.
* @return A proxy with the specified encoding version.
*/
Prx ice_encodingVersion(const ::Ice::EncodingVersion& version) const
Prx ice_encodingVersion(EncodingVersion version) const
{
return fromReference(asPrx()._encodingVersion(version));
return fromReference(asPrx()._encodingVersion(std::move(version)));
}

/**
* Obtains a proxy that is identical to this proxy, except for the endpoint selection policy.
* @param type The new endpoint selection policy.
* @return A proxy with the specified endpoint selection policy.
*/
Prx ice_endpointSelection(::Ice::EndpointSelectionType type) const
Prx ice_endpointSelection(EndpointSelectionType type) const
{
return fromReference(asPrx()._endpointSelection(type));
}
Expand All @@ -150,9 +149,9 @@ namespace Ice
* @param endpoints The endpoints for the new proxy.
* @return A proxy with the new endpoints.
*/
Prx ice_endpoints(const ::Ice::EndpointSeq& endpoints) const
Prx ice_endpoints(EndpointSeq endpoints) const
{
return fromReference(asPrx()._endpoints(endpoints));
return fromReference(asPrx()._endpoints(std::move(endpoints)));
}

/**
Expand All @@ -161,9 +160,9 @@ namespace Ice
* @param connection The fixed proxy connection.
* @return A fixed proxy bound to the given connection.
*/
Prx ice_fixed(const std::shared_ptr<::Ice::Connection>& connection) const
Prx ice_fixed(std::shared_ptr<Connection> connection) const
{
return fromReference(asPrx()._fixed(connection));
return fromReference(asPrx()._fixed(std::move(connection)));
}

/**
Expand Down Expand Up @@ -210,7 +209,10 @@ namespace Ice
* @param router The router for the new proxy.
* @return A proxy with the specified router.
*/
Prx ice_router(const std::optional<RouterPrx>& router) const { return fromReference(asPrx()._router(router)); }
Prx ice_router(const std::optional<RouterPrx>& router) const
{
return fromReference(asPrx()._router(std::move(router)));
}

/**
* Obtains a proxy that is identical to this proxy, except for how it selects endpoints.
Expand Down Expand Up @@ -264,7 +266,7 @@ namespace Ice
ObjectPrx(const ObjectPrx& other) noexcept = default;
ObjectPrx(ObjectPrx&&) noexcept = default;

ObjectPrx(const std::shared_ptr<Ice::Communicator>& communicator, const std::string& proxyString);
ObjectPrx(const std::shared_ptr<Ice::Communicator>& communicator, std::string_view proxyString);

virtual ~ObjectPrx() = default;

Expand Down Expand Up @@ -435,7 +437,7 @@ namespace Ice
* @return The future object for the invocation.
*/
std::future<std::tuple<bool, std::vector<std::uint8_t>>> ice_invokeAsync(
const std::string& operation,
std::string_view operation,
Ice::OperationMode mode,
const std::vector<std::uint8_t>& inParams,
const Ice::Context& context = Ice::noExplicitContext) const;
Expand Down Expand Up @@ -488,7 +490,7 @@ namespace Ice
* @return The future object for the invocation.
*/
std::future<std::tuple<bool, std::vector<std::uint8_t>>> ice_invokeAsync(
const std::string& operation,
std::string_view operation,
Ice::OperationMode mode,
const std::pair<const std::uint8_t*, const std::uint8_t*>& inParams,
const Ice::Context& context = Ice::noExplicitContext) const;
Expand Down Expand Up @@ -584,7 +586,7 @@ namespace Ice
* @param id The identity for the new proxy.
* @return A proxy with the new identity.
*/
ObjectPrx ice_identity(const Ice::Identity& id) const;
ObjectPrx ice_identity(Ice::Identity id) const;

/**
* Obtains the per-proxy context for this proxy.
Expand All @@ -603,7 +605,7 @@ namespace Ice
* @param facet The facet for the new proxy.
* @return A proxy with the new facet.
*/
Ice::ObjectPrx ice_facet(const ::std::string& facet) const;
Ice::ObjectPrx ice_facet(std::string facet) const;

/**
* Obtains the adapter ID for this proxy.
Expand Down Expand Up @@ -739,7 +741,7 @@ namespace Ice
* Returns the Slice type ID associated with this type.
* @return The Slice type ID.
*/
static std::string_view ice_staticId();
static std::string_view ice_staticId() noexcept;

/**
* Obtains the communicator that created this proxy.
Expand Down Expand Up @@ -781,19 +783,19 @@ namespace Ice
template<typename Prx, typename... Bases> friend class Proxy;

// Gets a reference with the specified setting; returns _reference if the setting is already set.
IceInternal::ReferencePtr _adapterId(const std::string&) const;
IceInternal::ReferencePtr _adapterId(std::string) const;
IceInternal::ReferencePtr _batchDatagram() const;
IceInternal::ReferencePtr _batchOneway() const;
IceInternal::ReferencePtr _collocationOptimized(bool) const;
IceInternal::ReferencePtr _compress(bool) const;
IceInternal::ReferencePtr _connectionCached(bool) const;
IceInternal::ReferencePtr _connectionId(const std::string&) const;
IceInternal::ReferencePtr _context(const Context&) const;
IceInternal::ReferencePtr _connectionId(std::string) const;
IceInternal::ReferencePtr _context(Context) const;
IceInternal::ReferencePtr _datagram() const;
IceInternal::ReferencePtr _encodingVersion(const EncodingVersion&) const;
IceInternal::ReferencePtr _encodingVersion(EncodingVersion) const;
IceInternal::ReferencePtr _endpointSelection(EndpointSelectionType) const;
IceInternal::ReferencePtr _endpoints(const EndpointSeq&) const;
IceInternal::ReferencePtr _fixed(const ConnectionPtr&) const;
IceInternal::ReferencePtr _endpoints(EndpointSeq) const;
IceInternal::ReferencePtr _fixed(ConnectionPtr) const;
IceInternal::ReferencePtr _invocationTimeout(int) const;
IceInternal::ReferencePtr _locator(const std::optional<LocatorPrx>&) const;
IceInternal::ReferencePtr _locatorCacheTimeout(int) const;
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Ice
* Obtains the Slice type ID of this type.
* @return The return value is always "::Ice::Object".
*/
static std::string_view ice_staticId();
static std::string_view ice_staticId() noexcept;

/**
* Returns a shallow copy of the object.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/IceBT/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace IceBT
* Obtains the Slice type ID of this exception.
* @return The fully-scoped type ID.
*/
ICE_MEMBER(ICEBT_API) static ::std::string_view ice_staticId();
ICE_MEMBER(ICEBT_API) static ::std::string_view ice_staticId() noexcept;
/**
* Prints this exception to the given stream.
* @param stream The target stream.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/IceBox/Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace IceBox
* Obtains the Slice type ID of this exception.
* @return The fully-scoped type ID.
*/
ICE_MEMBER(ICEBOX_API) static ::std::string_view ice_staticId();
ICE_MEMBER(ICEBOX_API) static ::std::string_view ice_staticId() noexcept;
/**
* Prints this exception to the given stream.
* @param stream The target stream.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace
}

std::string_view
Ice::UserException::ice_staticId()
Ice::UserException::ice_staticId() noexcept
{
return userException_ids[0];
}
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace
}

std::string_view
Ice::LocalException::ice_staticId()
Ice::LocalException::ice_staticId() noexcept
{
return localException_ids[0];
}
Expand Down
Loading
Loading