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