Cleaned up indentation & comments
This commit is contained in:
parent
dcb98bede6
commit
8b94ed59e6
|
@ -16,6 +16,9 @@ using namespace i18n::phonenumbers;
|
|||
|
||||
static const PhoneNumberUtil* const phoneUtil = PhoneNumberUtil::GetInstance();
|
||||
|
||||
/**
|
||||
* Clips a value to the given (inclusive) range
|
||||
*/
|
||||
template <typename T>
|
||||
T clip(const T& n, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(n, upper));
|
||||
|
@ -25,6 +28,9 @@ T clip(const T& n, const T& lower, const T& upper) {
|
|||
* Utility functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Converts a text object to a C-style string
|
||||
*/
|
||||
static char* textToCString(const text* text) {
|
||||
size_t len = VARSIZE(text) - VARHDRSZ;
|
||||
char* str = (char*)palloc(len + 1);
|
||||
|
|
|
@ -42,6 +42,8 @@ CREATE FUNCTION phone_number_equal(phone_number, phone_number) RETURNS bool
|
|||
LANGUAGE c IMMUTABLE STRICT
|
||||
AS 'pg_libphonenumber', 'phone_number_equal';
|
||||
|
||||
-- TODO: make these operators strict.
|
||||
|
||||
CREATE OPERATOR = (
|
||||
leftarg = phone_number,
|
||||
rightarg = phone_number,
|
||||
|
|
|
@ -47,4 +47,3 @@ ShortPhoneNumber::operator PhoneNumber() const {
|
|||
number.set_number_of_leading_zeros(leading_zeros);
|
||||
return number;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ class PhoneNumberTooLongException : public std::runtime_error {
|
|||
static const i18n::phonenumbers::PhoneNumberUtil* const phoneUtil;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stores a phone number (packed into a 64-bit integer)
|
||||
*/
|
||||
class ShortPhoneNumber {
|
||||
public:
|
||||
enum : size_t {
|
||||
|
@ -96,4 +99,3 @@ class ShortPhoneNumber {
|
|||
private:
|
||||
google::protobuf::uint64 _data;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue