inline void ignore_result(const T&) {
}
-// The following enum should be used only as a constructor argument to indicate
-// that the variable has static storage class, and that the constructor should
-// do nothing to its state. It indicates to the reader that it is legal to
-// declare a static instance of the class, provided the constructor is given
-// the base::LINKER_INITIALIZED argument. Normally, it is unsafe to declare a
-// static variable that has a constructor or a destructor because invocation
-// order is undefined. However, IF the type can be initialized by filling with
-// zeroes (which the loader does for static variables), AND the destructor also
-// does nothing to the storage, AND there are no virtual methods, then a
-// constructor declared as
-// explicit MyClass(base::LinkerInitialized x) {}
-// and invoked as
-// static MyClass my_variable_name(base::LINKER_INITIALIZED);
-namespace base {
-enum LinkerInitialized { LINKER_INITIALIZED };
-} // base
-
#endif // I18N_PHONENUMBERS_BASE_BASICTYPES_H_
#include "phonenumbers/base/basictypes.h"
#include "phonenumbers/base/template_util.h"
-namespace base {
+namespace i18n {
+namespace phonenumbers {
// Function object which deletes its parameter, which must be a pointer.
// If C is an array type, invokes 'delete[]' on the parameter; otherwise,
// cannot convert to T*.
enum { T_must_be_complete = sizeof(T) };
enum { U_must_be_complete = sizeof(U) };
- COMPILE_ASSERT((base::is_convertible<U*, T*>::value),
+ COMPILE_ASSERT((is_convertible<U*, T*>::value),
U_ptr_must_implicitly_convert_to_T_ptr);
}
inline void operator()(T* ptr) const {
};
} // namespace internal
-
-} // namespace base
+} // namespace phonenumbers
+} // namespace i18n
// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
// automatically deletes the pointer it holds (if any).
// unique_ptr<> features. Known deficiencies include not supporting move-only
// deleteres, function pointers as deleters, and deleters with reference
// types.
-template <class T, class D = base::DefaultDeleter<T> >
+template <class T, class D = i18n::phonenumbers::DefaultDeleter<T> >
class scoped_ptr {
public:
// The element and deleter types.
// implementation of scoped_ptr.
template <typename U, typename V>
scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
- COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
+ COMPILE_ASSERT(!i18n::phonenumbers::is_array<U>::value,
+ U_cannot_be_an_array);
}
// operator=. Allows assignment from a scoped_ptr rvalue for a convertible
// scoped_ptr.
template <typename U, typename V>
scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
- COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
+ COMPILE_ASSERT(!i18n::phonenumbers::is_array<U>::value,
+ U_cannot_be_an_array);
impl_.TakeState(&rhs.impl_);
return *this;
}
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
// implicitly convertible to a real bool (which is dangerous).
private:
- typedef base::internal::scoped_ptr_impl<element_type, deleter_type>
- scoped_ptr::*Testable;
+ typedef i18n::phonenumbers::internal::scoped_ptr_impl<
+ element_type, deleter_type> scoped_ptr::*Testable;
public:
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
private:
// Needed to reach into |impl_| in the constructor.
template <typename U, typename V> friend class scoped_ptr;
- base::internal::scoped_ptr_impl<element_type, deleter_type> impl_;
+ i18n::phonenumbers::internal::scoped_ptr_impl<
+ element_type, deleter_type> impl_;
// Forbid comparison of scoped_ptr types. If U != T, it totally
// doesn't make sense, and if U == T, it still doesn't make sense
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
// implicitly convertible to a real bool (which is dangerous).
private:
- typedef base::internal::scoped_ptr_impl<element_type, deleter_type>
- scoped_ptr::*Testable;
+ typedef i18n::phonenumbers::internal::scoped_ptr_impl<
+ element_type, deleter_type> scoped_ptr::*Testable;
public:
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
enum { type_must_be_complete = sizeof(element_type) };
// Actually hold the data.
- base::internal::scoped_ptr_impl<element_type, deleter_type> impl_;
+ i18n::phonenumbers::internal::scoped_ptr_impl<
+ element_type, deleter_type> impl_;
// Disable initialization from any type other than element_type*, by
// providing a constructor that matches such an initialization, but is
#if defined(I18N_PHONENUMBERS_USE_BOOST)
#include <boost/thread/mutex.hpp>
-namespace base {
- typedef boost::mutex Lock;
- typedef boost::mutex::scoped_lock AutoLock;
-}
+namespace i18n {
+namespace phonenumbers {
+
+typedef boost::mutex Lock;
+typedef boost::mutex::scoped_lock AutoLock;
+
+} // namespace phonenumbers
+} // namespace i18n
#else // I18N_PHONENUMBERS_USE_BOOST
#include "phonenumbers/base/thread_safety_check.h"
-namespace base {
+namespace i18n {
+namespace phonenumbers {
// Dummy lock implementation. If you care about thread-safety, please compile
// with -DI18N_PHONENUMBERS_USE_BOOST.
AutoLock(Lock) {}
};
-} // namespace base
+} // namespace phonenumbers
+} // namespace i18n
#endif // I18N_PHONENUMBERS_USE_BOOST
#endif // I18N_PHONENUMBERS_BASE_SYNCHRONIZATION_LOCK_H_