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