* style cleanup - no functional change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Stefano Ceccherini ([email protected])
|
||||
*/
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@@ -18,13 +19,16 @@
|
||||
|
||||
#include "TextGapBuffer.h"
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
static const int32 kTextGapBufferBlockSize = 2048;
|
||||
|
||||
|
||||
TextGapBuffer::TextGapBuffer()
|
||||
: fItemCount(0),
|
||||
:
|
||||
fItemCount(0),
|
||||
fBuffer(NULL),
|
||||
fBufferCount(kTextGapBufferBlockSize + fItemCount),
|
||||
fGapIndex(fItemCount),
|
||||
@@ -69,7 +73,8 @@ TextGapBuffer::InsertText(const char *inText, int32 inNumItems, int32 inAtIndex)
|
||||
|
||||
|
||||
void
|
||||
TextGapBuffer::InsertText(BFile *file, int32 fileOffset, int32 inNumItems, int32 inAtIndex)
|
||||
TextGapBuffer::InsertText(BFile* file, int32 fileOffset, int32 inNumItems,
|
||||
int32 inAtIndex)
|
||||
{
|
||||
off_t fileSize;
|
||||
|
||||
@@ -203,8 +208,8 @@ TextGapBuffer::GetString(int32 fromOffset, int32 *_numBytes)
|
||||
result = fScratchBuffer;
|
||||
}
|
||||
|
||||
// TODO: this could be improved. We are overwriting what we did some lines ago,
|
||||
// we could just avoid to do that.
|
||||
// TODO: this could be improved. We are overwriting what we did some lines
|
||||
// ago, we could just avoid to do that.
|
||||
if (fPasswordMode) {
|
||||
uint32 numChars = UTF8CountChars(result, numBytes);
|
||||
uint32 charLen = UTF8CountBytes(B_UTF8_BULLET, 1);
|
||||
|
||||
@@ -5,48 +5,50 @@
|
||||
* Authors:
|
||||
* Marc Flerackers ([email protected])
|
||||
*/
|
||||
|
||||
#ifndef __TEXTGAPBUFFER_H
|
||||
#define __TEXTGAPBUFFER_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <TextView.h>
|
||||
|
||||
|
||||
class BFile;
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class TextGapBuffer {
|
||||
public:
|
||||
TextGapBuffer();
|
||||
virtual ~TextGapBuffer();
|
||||
~TextGapBuffer();
|
||||
|
||||
void InsertText(const char* inText, int32 inNumItems,
|
||||
int32 inAtIndex);
|
||||
void InsertText(BFile *file, int32 fileOffset, int32 amount,
|
||||
int32 atIndex);
|
||||
void InsertText(BFile* file, int32 fileOffset,
|
||||
int32 amount, int32 atIndex);
|
||||
void RemoveRange(int32 start, int32 end);
|
||||
|
||||
void MoveGapTo(int32 toIndex);
|
||||
void SizeGapTo(int32 inCount);
|
||||
|
||||
bool FindChar(char inChar, int32 fromIndex, int32 *ioDelta);
|
||||
bool FindChar(char inChar, int32 fromIndex,
|
||||
int32* ioDelta);
|
||||
|
||||
const char* Text();
|
||||
const char* RealText();
|
||||
int32 Length() const;
|
||||
|
||||
const char* GetString(int32 fromOffset, int32* numBytes);
|
||||
void GetString(int32 offset, int32 length, char *buffer);
|
||||
void GetString(int32 offset, int32 length,
|
||||
char* buffer);
|
||||
|
||||
char RealCharAt(int32 offset) const;
|
||||
|
||||
bool PasswordMode() const;
|
||||
void SetPasswordMode(bool);
|
||||
|
||||
// void Resize(int32 size);
|
||||
|
||||
protected:
|
||||
int32 fItemCount; // logical count
|
||||
char* fBuffer; // allocated memory
|
||||
@@ -78,6 +80,8 @@ TextGapBuffer::RealCharAt(int32 index) const
|
||||
return index < fGapIndex ? fBuffer[index] : fBuffer[index + fGapCount];
|
||||
}
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
#endif //__TEXTGAPBUFFER_H
|
||||
|
||||
Reference in New Issue
Block a user