Merge "libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation directory"
This commit is contained in:
commit
6ee734cfa0
9 changed files with 43 additions and 38 deletions
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/TypeHelpers.h>
|
#include <utils/TypeHelpers.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
@ -55,13 +54,7 @@ protected:
|
||||||
virtual ~BasicHashtableImpl();
|
virtual ~BasicHashtableImpl();
|
||||||
|
|
||||||
void dispose();
|
void dispose();
|
||||||
|
void edit();
|
||||||
inline void edit() {
|
|
||||||
if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
|
|
||||||
clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTo(const BasicHashtableImpl& other);
|
void setTo(const BasicHashtableImpl& other);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
#define ANDROID_STRING16_H
|
#define ANDROID_STRING16_H
|
||||||
|
|
||||||
#include <utils/Errors.h>
|
#include <utils/Errors.h>
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/Unicode.h>
|
#include <utils/Unicode.h>
|
||||||
#include <utils/TypeHelpers.h>
|
#include <utils/TypeHelpers.h>
|
||||||
|
|
||||||
|
|
@ -34,6 +33,7 @@ namespace android {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class SharedBuffer;
|
||||||
class String8;
|
class String8;
|
||||||
class TextOutput;
|
class TextOutput;
|
||||||
|
|
||||||
|
|
@ -64,10 +64,10 @@ public:
|
||||||
~String16();
|
~String16();
|
||||||
|
|
||||||
inline const char16_t* string() const;
|
inline const char16_t* string() const;
|
||||||
inline size_t size() const;
|
|
||||||
|
|
||||||
inline const SharedBuffer* sharedBuffer() const;
|
const SharedBuffer* sharedBuffer() const;
|
||||||
|
|
||||||
|
size_t size() const;
|
||||||
void setTo(const String16& other);
|
void setTo(const String16& other);
|
||||||
status_t setTo(const char16_t* other);
|
status_t setTo(const char16_t* other);
|
||||||
status_t setTo(const char16_t* other, size_t len);
|
status_t setTo(const char16_t* other, size_t len);
|
||||||
|
|
@ -144,16 +144,6 @@ inline const char16_t* String16::string() const
|
||||||
return mString;
|
return mString;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String16::size() const
|
|
||||||
{
|
|
||||||
return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const SharedBuffer* String16::sharedBuffer() const
|
|
||||||
{
|
|
||||||
return SharedBuffer::bufferFromData(mString);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline String16& String16::operator=(const String16& other)
|
inline String16& String16::operator=(const String16& other)
|
||||||
{
|
{
|
||||||
setTo(other);
|
setTo(other);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
#define ANDROID_STRING8_H
|
#define ANDROID_STRING8_H
|
||||||
|
|
||||||
#include <utils/Errors.h>
|
#include <utils/Errors.h>
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/Unicode.h>
|
#include <utils/Unicode.h>
|
||||||
#include <utils/TypeHelpers.h>
|
#include <utils/TypeHelpers.h>
|
||||||
|
|
||||||
|
|
@ -29,6 +28,7 @@
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
class SharedBuffer;
|
||||||
class String16;
|
class String16;
|
||||||
class TextOutput;
|
class TextOutput;
|
||||||
|
|
||||||
|
|
@ -65,11 +65,11 @@ public:
|
||||||
|
|
||||||
inline const char* string() const;
|
inline const char* string() const;
|
||||||
inline size_t size() const;
|
inline size_t size() const;
|
||||||
inline size_t length() const;
|
|
||||||
inline size_t bytes() const;
|
inline size_t bytes() const;
|
||||||
inline bool isEmpty() const;
|
inline bool isEmpty() const;
|
||||||
|
|
||||||
inline const SharedBuffer* sharedBuffer() const;
|
size_t length() const;
|
||||||
|
const SharedBuffer* sharedBuffer() const;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
@ -263,11 +263,6 @@ inline const char* String8::string() const
|
||||||
return mString;
|
return mString;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String8::length() const
|
|
||||||
{
|
|
||||||
return SharedBuffer::sizeFromData(mString)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline size_t String8::size() const
|
inline size_t String8::size() const
|
||||||
{
|
{
|
||||||
return length();
|
return length();
|
||||||
|
|
@ -280,12 +275,7 @@ inline bool String8::isEmpty() const
|
||||||
|
|
||||||
inline size_t String8::bytes() const
|
inline size_t String8::bytes() const
|
||||||
{
|
{
|
||||||
return SharedBuffer::sizeFromData(mString)-1;
|
return length();
|
||||||
}
|
|
||||||
|
|
||||||
inline const SharedBuffer* String8::sharedBuffer() const
|
|
||||||
{
|
|
||||||
return SharedBuffer::bufferFromData(mString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool String8::contains(const char* other) const
|
inline bool String8::contains(const char* other) const
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
#include <utils/BasicHashtable.h>
|
#include <utils/BasicHashtable.h>
|
||||||
#include <utils/misc.h>
|
#include <utils/misc.h>
|
||||||
|
|
||||||
|
#include "SharedBuffer.h"
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
|
BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
|
||||||
|
|
@ -46,6 +48,12 @@ BasicHashtableImpl::~BasicHashtableImpl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BasicHashtableImpl::edit() {
|
||||||
|
if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
|
||||||
|
clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BasicHashtableImpl::dispose() {
|
void BasicHashtableImpl::dispose() {
|
||||||
if (mBuckets) {
|
if (mBuckets) {
|
||||||
releaseBuckets(mBuckets, mBucketCount);
|
releaseBuckets(mBuckets, mBucketCount);
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/Atomic.h>
|
#include <utils/Atomic.h>
|
||||||
|
|
||||||
|
#include "SharedBuffer.h"
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "SharedBuffer.h"
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
|
@ -165,6 +166,16 @@ String16::~String16()
|
||||||
SharedBuffer::bufferFromData(mString)->release();
|
SharedBuffer::bufferFromData(mString)->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t String16::size() const
|
||||||
|
{
|
||||||
|
return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SharedBuffer* String16::sharedBuffer() const
|
||||||
|
{
|
||||||
|
return SharedBuffer::bufferFromData(mString);
|
||||||
|
}
|
||||||
|
|
||||||
void String16::setTo(const String16& other)
|
void String16::setTo(const String16& other)
|
||||||
{
|
{
|
||||||
SharedBuffer::bufferFromData(other.mString)->acquire();
|
SharedBuffer::bufferFromData(other.mString)->acquire();
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,13 @@
|
||||||
#include <utils/Compat.h>
|
#include <utils/Compat.h>
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include <utils/Unicode.h>
|
#include <utils/Unicode.h>
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/String16.h>
|
#include <utils/String16.h>
|
||||||
#include <utils/threads.h>
|
#include <utils/threads.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "SharedBuffer.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions outside android is below the namespace android, since they use
|
* Functions outside android is below the namespace android, since they use
|
||||||
* functions and constants in android namespace.
|
* functions and constants in android namespace.
|
||||||
|
|
@ -211,6 +212,16 @@ String8::~String8()
|
||||||
SharedBuffer::bufferFromData(mString)->release();
|
SharedBuffer::bufferFromData(mString)->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t String8::length() const
|
||||||
|
{
|
||||||
|
return SharedBuffer::sizeFromData(mString)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SharedBuffer* String8::sharedBuffer() const
|
||||||
|
{
|
||||||
|
return SharedBuffer::bufferFromData(mString);
|
||||||
|
}
|
||||||
|
|
||||||
String8 String8::format(const char* fmt, ...)
|
String8 String8::format(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,10 @@
|
||||||
#include <cutils/log.h>
|
#include <cutils/log.h>
|
||||||
|
|
||||||
#include <utils/Errors.h>
|
#include <utils/Errors.h>
|
||||||
#include <utils/SharedBuffer.h>
|
|
||||||
#include <utils/VectorImpl.h>
|
#include <utils/VectorImpl.h>
|
||||||
|
|
||||||
|
#include "SharedBuffer.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue