Initial import

This commit is contained in:
ocoursiere
2003-02-05 21:41:30 +00:00
parent 5544674f6c
commit e964d59f65
3 changed files with 695 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
/* BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursière
Eric Jourde
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _FLATTENABLE_CPP_
#define _FLATTENABLE_CPP_
#include "Flattenable.h"
#include <beobj.h>
#if defined(__cplusplus)
extern "C" {
#endif
/***********************************************************************
* AUTHOR: <baron>
* FILE: Flattenable.cpp
* DATE: Thu Jan 23 21:06:42 2003
* DESCR:
***********************************************************************/
/***********************************************************************
* Method: BFlattenable::AllowsTypeCode
* Params: type_code code
* Returns: bool
* Effects:
***********************************************************************/
bool
BFlattenable_AllowsTypeCode(BFlattenable *Flattenable, type_code code)
{
return Flattenable->AllowsTypeCode(code);
}
/***********************************************************************
* Method: BFlattenable::~BFlattenable
* Params:
* Effects:
***********************************************************************/
void BFlattenable_Free(BFlattenable *Flattenable)
{
delete Flattenable;
}
bool BFlattenable_IsFixedSize(BFlattenable *Flattenable)
{
return Flattenable->IsFixedSize();
}
type_code BFlattenable_TypeCode(BFlattenable *Flattenable)
{
return Flattenable->TypeCode();
}
ssize_t BFlattenable_FlattenedSize(BFlattenable *Flattenable)
{
return Flattenable->FlattenedSize();
}
status_t BFlattenable_Flatten(BFlattenable *Flattenable,void *buffer, ssize_t size)
{
return Flattenable->Flatten(buffer,size);
}
status_t BFlattenable_Unflatten(BFlattenable *Flattenable,type_code c, const void *buf, ssize_t size)
{
return Flattenable->Unflatten(c,buf,size);
}
#if defined(__cplusplus)
}
#endif
#endif /* _FLATTENABLE_CPP_ */

View File

@@ -0,0 +1,510 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Eric Jourde
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit BString;
interface
uses
beobj, SupportDefs, os;
type
TString = class(TBeObject)
private
public
constructor Create; override;
// constructor Create(value : PChar); override;
destructor Destroy; override;
function CountChars : integer;
function length : integer;
function String_pchar : PChar;
// Affectation
procedure SetTo(value:PChar; lenght : cardinal);
procedure SetTo( from: TString);
procedure SetTo( value:TString; length1: cardinal);
procedure Adopt( from:TString);
end;
function BString_Create(AObject : TBeObject):TCPlusObject; cdecl; external BePascalLibName name 'BString_Create';
function BString_Create(AObject : TBeObject;value : PChar):TCPlusObject; cdecl; external BePascalLibName name 'BString_Create_1';
procedure BString_Free(AObject : TCPlusObject);cdecl; external BePascalLibName name 'BString_Free';
function BString_CountChars(AObject : TCPlusObject): cardinal;cdecl; external BePascalLibName name 'BString_CountChars';
function BString_Length(AObject : TCPlusObject): cardinal;cdecl; external BePascalLibName name 'BString_Length';
function BString_String(AObject : TCPlusObject): Pchar;cdecl; external BePascalLibName name 'BString_String';
procedure BString_SetTo(AObject : TCPlusObject;value:Pchar;length:cardinal);cdecl; external BePascalLibName name 'BString_SetTo';
procedure BString_SetTo_1(AObject : TCPlusObject; from: TBeObject);cdecl; external BePascalLibName name 'BString_SetTo_1';
procedure BString_SetTo_2(AObject : TCPlusObject; value:TBeObject;length: cardinal);cdecl; external BePascalLibName name 'BString_SetTo_2';
procedure BString_Adopt(AObject : TCPlusObject; from:TBeObject);cdecl; external BePascalLibName name 'BString_Adopt';
{
BString &
BString_Adopt_1(BString *String, BString &from,
int32 length)
BString &
BString_SetTo_3(BString *String, char value,
int32 count)
BString &
BString_CopyInto(BString *String, BString &into,
int32 fromOffset,
int32 length)
void
BString_CopyInto_1
(BString *String, char *into,
int32 fromOffset,
int32 length)
BString &
BString_Append(BString *String, const BString &value,
int32 length)
BString &
BString_Append_1
(BString *String, const char *value,
int32 length)
BString &
BString_Append_2
(BString *String, char value,
int32 count)
BString &
BString_Prepend(BString *String, const char *value)
BString &
BString_Prepend_1
(BString *String, const BString &value)
BString &
BString_Prepend_2
(BString *String, const char *value,
int32 length)
BString &
BString_Prepend_3
(BString *String, const BString &value,
int32 length)
BString &
BString_Prepend_4
(BString *String, char value,
int32 count)
BString &
BString_Insert(BString *String, const char *value,
int32 pos)
BString &
BString_Insert_1
(BString *String, const char *value,
int32 length,
int32 pos)
BString &
BString_Insert_2
(BString *String, const char *value,
int32 fromOffset,
int32 length,
int32 pos)
BString &
BString_Insert_3
(BString *String, const BString &value,
int32 pos)
BString &
BString_Insert_4
(BString *String, const BString &value,
int32 length,
int32 pos)
BString &
BString_Insert_5
(BString *String, const BString &value,
int32 fromOffset,
int32 length,
int32 pos)
BString &
BString_Insert_6
(BString *String, char value,
int32 count,
int32 pos)
BString &
BString_Truncate(BString *String, int32 newLength,
bool lazy)
BString &
BString_Remove(BString *String, int32 from,
int32 length)
BString &
BString_RemoveFirst_1
(BString *String, const BString &value)
BString &
BString_RemoveLast(BString *String, const BString &value)
BString &
BString_RemoveAll(BString *String, const BString &value)
BString &
BString_RemoveFirst(BString *String, const char *value)
BString &
BString_RemoveLast_1(BString *String, const char *value)
BString &
BString_RemoveAll_1(BString *String, const char *value)
BString &
BString_RemoveSet(BString *String, const char *setOfCharsToRemove)
BString &
BString_MoveInto(BString *String, BString &into,
int32 from,
int32 length)
void
BString_MoveInto_1
(BString *String, char *into,
int32 from,
int32 length)
int
BString_Compare(BString *String, const BString &value)
int
BString_Compare_1
(BString *String, const char *value)
int
BString_Compare_2
(BString *String, const BString &value,
int32 n)
int
BString_Compare_3
(BString *String, const char *value,
int32 n)
int
BString_ICompare(BString *String, const BString &value)
int
BString_ICompare_1
(BString *String, const char *value)
int
BString_ICompare_2
(BString *String, const BString &value,
int32 n)
int
BString_ICompare_3
(BString *String, const char *value,
int32 n)
int32
BString_FindFirst(BString *String, const BString &value)
int32
BString_FindFirst_1
(BString *String, const char *value)
int32
BString_FindFirst_2
(BString *String, const BString &value,
int32 fromOffset)
int32
BString_FindFirst_3
(BString *String, const char *value,
int32 fromOffset)
int32
BString_FindFirst_4
(BString *String, char value)
int32
BString_FindFirst_5
(BString *String, char value,
int32 fromOffset)
int32
BString_FindLast(BString *String, const BString &value)
int32
BString_FindLast_1
(BString *String, const char *value)
int32
BString_FindLast_2
(BString *String, const BString &value,
int32 beforeOffset)
int32
BString_FindLast_3
(BString *String, const char *value,
int32 beforeOffset)
int32
BString_FindLast_4
(BString *String, char value)
int32
BString_FindLast_5
(BString *String, char value,
int32 fromOffset)
int32
BString_IFindFirst(BString *String, const BString &value)
int32
BString_IFindFirst_1
(BString *String, const char *value)
int32
BString_IFindFirst_2
(BString *String, const BString &value,
int32 fromOffset)
int32
BString_IFindFirst_3
(BString *String, const char *value,
int32 fromOffset)
int32
BString_IFindLast(BString *String, const BString &value)
int32
BString_IFindLast_1
(BString *String, const char *value)
int32
BString_IFindLast_2
(BString *String, const BString &value,
int32 beforeOffset)
int32
BString_IFindLast_3
(BString *String, const char *value,
int32 beforeOffset)
BString &
BString_ReplaceFirst(BString *String, char replaceThis,
char withThis)
BString &
BString_ReplaceLast(BString *String, char replaceThis,
char withThis)
BString &
BString_ReplaceAll(BString *String, char replaceThis,
char withThis,
int32 fromOffset)
BString &
BString_Replace(BString *String, char replaceThis,
char withThis,
int32 maxReplaceCount,
int32 fromOffset)
BString &
BString_ReplaceFirst_1
(BString *String, const char *replaceThis,
const char *withThis)
BString &
BString_ReplaceLast_1(BString *String, const char *replaceThis,
const char *withThis)
BString &
BString_ReplaceAll_1(BString *String, const char *replaceThis,
const char *withThis,
int32 fromOffset)
BString &
BString_Replace_1(BString *String, const char *replaceThis,
const char *withThis,
int32 maxReplaceCount,
int32 fromOffset)
BString &
BString_IReplaceFirst(BString *String, char replaceThis,
char withThis)
BString &
BString_IReplaceLast(BString *String, char replaceThis,
char withThis)
BString &
BString_IReplaceAll(BString *String, char replaceThis,
char withThis,
int32 fromOffset)
BString &
BString_IReplace(BString *String, char replaceThis,
char withThis,
int32 maxReplaceCount,
int32 fromOffset)
BString &
BString_IReplaceFirst_1
(BString *String, const char *replaceThis,
const char *withThis)
BString &
BString_IReplaceLast_1(BString *String, const char *replaceThis,
const char *withThis)
BString &
BString_IReplaceAll_1(BString *String, const char *replaceThis,
const char *withThis,
int32 fromOffset)
BString &
BString_IReplace_1(BString *String, const char *replaceThis,
const char *withThis,
int32 maxReplaceCount,
int32 fromOffset)
BString &
BString_ReplaceSet(BString *String, const char *setOfChars,
char with)
BString &
BString_ReplaceSet_1
(BString *String, const char *setOfChars,
const char *with)
char *
BString_LockBuffer(BString *String, int32 maxLength)
BString &
BString_UnlockBuffer(BString *String, int32 length)
BString &
BString_ToLower(BString *String)
BString &
BString_ToUpper(BString *String)
BString &
BString_Capitalize(BString *String)
BString &
BString_CapitalizeEachWord_1
(BString *String)
BString &
BString_CharacterEscape(BString *String, const char *original,
const char *setOfCharsToEscape,
char escapeWith)
BString &
BString_CharacterEscape_1
(BString *String, const char *setOfCharsToEscape,
char escapeWith)
BString &
BString_CharacterDeescape(BString *String, const char *original,
char escapeChar)
BString &
BString_CharacterDeescape_1
(BString *String, char escapeChar)
}
implementation
constructor TString.Create;
begin
inherited;
CPlusObject := BString_Create(Self);
end;
{constructor TString.Create_1(value:PChar);
begin
inherited;
CPlusObject := BString_Create_1(Self,value);
end;
}
destructor TString.Destroy;
begin
if CPlusObject <> nil then
BString_Free(CPlusObject);
inherited;
end;
function TString.CountChars : integer;
begin
result:=BString_CountChars(CPlusObject);
end;
function TString.length : integer;
begin
result:=BString_Length(CPlusObject);
end;
function TString.String_pchar : PChar;
begin
result:=BString_String(CPlusObject);
end;
procedure TString.SetTo(value:PChar; lenght : cardinal);
begin
BString_SetTo(CPlusObject,value,lenght);
end;
procedure TString.SetTo( from: TString);
begin
BString_SetTo_1(CPlusObject, from);
end;
procedure TString.SetTo( value:TString;length1: cardinal);
begin
BString_SetTo_2(CPlusObject, value,length1);
end;
procedure TString.Adopt( from:TString);
begin
BString_Adopt(CPlusObject, from);
end;
end.

View File

@@ -0,0 +1,96 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursière
Eric Jourde
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit Flattenable;
interface
uses
beobj, SupportDefs, os;
type
TFlattenable = class(TBeObject)
private
public
constructor Create; override;
destructor Destroy; override;
function IsFixedSize : boolean;
function TypeCode : Ttype_code;
function Flatten( buffer :pointer; size : Tssize_t) : Tstatus_t;
function AllowsTypeCode( code : Ttype_code) : boolean;
function Unflatten(c :Ttype_code ; buf :pointer ; size: Tssize_t) : Tstatus_t;
end;
procedure BFlattenable_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFlattenable_Free';
function BFlattenable_IsFixedSize(AObject : TCPlusObject) : boolean;cdecl; external BePascalLibName name 'BFlattenable_IsFixedSize';
function BFlattenable_TypeCode(AObject : TCPlusObject) : Ttype_code;cdecl; external BePascalLibName name 'BFlattenable_TypeCode';
function BFlattenable_Flatten( AObject : TCPlusObject;buffer :pointer; size : Tssize_t) : Tstatus_t;cdecl; external BePascalLibName name 'BFlattenable_Flatten';
function BFlattenable_AllowsTypeCode( AObject : TCPlusObject;code : Ttype_code) : boolean;cdecl; external BePascalLibName name 'BFlattenable_AllowsTypeCode';
function BFlattenable_Unflatten(AObject : TCPlusObject;c :Ttype_code ; buf :pointer ; size: Tssize_t) : Tstatus_t;cdecl; external BePascalLibName name 'BFlattenable_Unflatten';
implementation
constructor TFlattenable.Create;
begin
CreatePas;
CPlusObject:=self;
end;
destructor TFlattenable.Destroy;
begin
if CPlusObject <> nil then
BFlattenable_Free(CPlusObject);
inherited;
end;
function TFlattenable.IsFixedSize : boolean;
begin
result:=BFlattenable_IsFixedSize(CPlusObject);
end;
function TFlattenable.TypeCode : Ttype_code;
begin
result:=BFlattenable_TypeCode(CPlusObject);
end;
function TFlattenable.Flatten( buffer :pointer; size : Tssize_t) : Tstatus_t;
begin
result:=BFlattenable_Flatten(CPlusObject,buffer,size);
end;
function TFlattenable.AllowsTypeCode( code : Ttype_code) : boolean;
begin
result:=BFlattenable_AllowsTypeCode(CPlusObject,code);
end;
function TFlattenable.Unflatten(c :Ttype_code ; buf :pointer ; size: Tssize_t) : Tstatus_t;
begin
result:=BFlattenable_Unflatten(CPlusObject,c,buf,size);
end;
end.