Skip to content

Commit

Permalink
namespace cleanup (#3427)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Jan 26, 2025
1 parent ad7819c commit bd5d7aa
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 132 deletions.
182 changes: 91 additions & 91 deletions cpp/include/Ice/Comparable.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,104 +111,104 @@ namespace Ice
}
}
};
}

namespace Tuple
namespace Ice::Tuple
{
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares less than the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator<(const T& lhs, const T& rhs)
{
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares less than the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator<(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() < rhs.ice_tuple();
}
return lhs.ice_tuple() < rhs.ice_tuple();
}

/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares less than or equal to the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator<=(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() <= rhs.ice_tuple();
}
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares less than or equal to the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator<=(const T& lhs, const T& rhs)
{
return lhs.ice_tuple() <= rhs.ice_tuple();
}

/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares greater than the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator>(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() > rhs.ice_tuple();
}
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares greater than the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator>(const T& lhs, const T& rhs)
{
return lhs.ice_tuple() > rhs.ice_tuple();
}

/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares greater than or equal to the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator>=(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() >= rhs.ice_tuple();
}
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares greater than or equal to the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator>=(const T& lhs, const T& rhs)
{
return lhs.ice_tuple() >= rhs.ice_tuple();
}

/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares equal to the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator==(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() == rhs.ice_tuple();
}
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side compares equal to the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator==(const T& lhs, const T& rhs)
{
return lhs.ice_tuple() == rhs.ice_tuple();
}

/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side is not equal to the right-hand side, false otherwise.
*/
template<
class C,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator!=(const C& lhs, const C& rhs)
{
return lhs.ice_tuple() != rhs.ice_tuple();
}
/**
* Relational operator for generated structs.
* @param lhs The left-hand side.
* @param rhs The right-hand side.
* @return True if the left-hand side is not equal to the right-hand side, false otherwise.
*/
template<
class T,
std::enable_if_t<
std::is_member_function_pointer_v<decltype(&T::ice_tuple)> && !std::is_polymorphic_v<T>,
bool> = true>
bool operator!=(const T& lhs, const T& rhs)
{
return lhs.ice_tuple() != rhs.ice_tuple();
}
}

Expand Down
38 changes: 17 additions & 21 deletions cpp/src/Glacier2/InstrumentationI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,32 @@ namespace

SessionHelper::Attributes SessionHelper::attributes;

namespace
struct ForwardedUpdate
{
struct ForwardedUpdate
{
ForwardedUpdate(bool clientP) : client(clientP) {}
ForwardedUpdate(bool clientP) : client(clientP) {}

void operator()(const shared_ptr<SessionMetrics>& v)
void operator()(const shared_ptr<SessionMetrics>& v)
{
if (client)
{
if (client)
++v->forwardedClient;
if (v->queuedClient > 0)
{
++v->forwardedClient;
if (v->queuedClient > 0)
{
--v->queuedClient;
}
--v->queuedClient;
}
else
}
else
{
++v->forwardedServer;
if (v->queuedServer > 0)
{
++v->forwardedServer;
if (v->queuedServer > 0)
{
--v->queuedServer;
}
--v->queuedServer;
}
}
}

int client;
};

}
int client;
};
}

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,35 +100,32 @@ namespace
{
}

namespace
{
#if defined(__APPLE__) || defined(_WIN32)

const char* const padBytes0 = "";
const char* const padBytes1 = "=";
const char* const padBytes2 = "==";
const char* const padBytes0 = "";
const char* const padBytes1 = "=";
const char* const padBytes2 = "==";

inline string paddingBytes(size_t length)
inline string paddingBytes(size_t length)
{
switch (length % 4)
{
switch (length % 4)
case 2:
{
return padBytes2;
}
case 3:
{
case 2:
{
return padBytes2;
}
case 3:
{
return padBytes1;
}
default:
{
return padBytes0;
}
return padBytes1;
}
default:
{
return padBytes0;
}
}
}
#endif

}
bool CryptPermissionsVerifierI::checkPermissions(string userId, string password, string&, const Current&) const
{
auto p = _passwords.find(userId);
Expand Down

0 comments on commit bd5d7aa

Please sign in to comment.