Main Page Cookbook/Overview ImageMeister the jcprops file Licensing Please Vote! Binary Installation & Configuration [ Win · Mac · Nix ] Changes Public API Source Code Main Page Java [ Common · Win · Mac · Nix ] Native Code [ Common · Win · Mac · Nix ] Manifest Native Code Overviews [ Common · Win · Mac · Nix · Strings ] Macros [ General · Native Macros ] Walkthroughs [ Java only · Java and native ] Building [ Win · Mac · Nix ] Distribution Issues

# CStrA

  Represents an ASCII/MBCS/UTF string.

[ Common | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

## Quick Index

  DESCRIPTION
  MACROS

## Class Summary

class CStrA
{
public:

  CStrA( JNIEnv *pEnv, jstring pStr );
  CStrA( JRIEnv *pEnv, JRIStringID pStr );
  CStrA( Hjava_lang_String *ps );
  CStrA( long len );
  CStrA( const char *s );
  CStrA( const wchar_t *s );
  CStrA( const CStrA *cs );
  ~CStrA();
  jstring getJString( JNIEnv *pEnv );
  JRIStringID getJString( JRIEnv *pEnv );
  Hjava_lang_String *getJString();
  char *getBuf() const;
  long getLength() const;
  void toUpper();
  void toLower();
  void setBuf( const char *s );
  void setBuf( const CStrA *cs );
  void ensureCharCapacity( long cap );
  long getCharCapacity() const;
  long getByteCapacity() const;
  void concat( const char *s );
  void concat( const CStrA *cs );
  void truncateAt( long wh );
  BOOL contains( const CStrA *cs ) const;
  BOOL contains( const char *s ) const;
  BOOL startsWith( const CStrA *cs ) const;
  BOOL startsWith( const char *s ) const;
  BOOL isEqual( const CStrA *cs ) const;
  BOOL isEqual( const char *s ) const;
  BOOL isEqualIgnoreCase( const CStrA *cs ) const;
  BOOL isEqualIgnoreCase( const char *s ) const;
  void copyInto( char *s );
  long replaceFrom( long startIndex, const char *searchString, const CStrA *csReplace );
  BOOL isSubstringOf( const char *s ) const;
  BOOL extractExeFileName( CStrA *csDest );
  void formatInt( const char *lpszFormat, long num );
  static long countPackedStrings( const CStrA *ps );
  static CStrA *getPackedString( const CStrA *ps, long i );

protected:

}; // CStrA

Back to the top of CStrA

### DESCRIPTION

Represents an ASCII/MBCS/UTF string. This class can be created from a Java string, and a Java string can be created from objects of this class. A set of macros are used to make it easier to work with these objects. See the 'string.html' file for more information.

Back to the top of CStrA

### MACROS

These macros are defined in CString.h, and are defined using CStr, not CStrA

    DECLARESTR(a)
    	Allocates space for a CStr*, and sets it to null

    MAKESTR(a,b)
    	Constructs a CStr from a Java String. If 'a' is null, or if an exception
    	occurs, sets 'theErr' and jumps to 'bail'
    	'a' is the Java string ( JSTRING )
    	'b' is the CStr*

    DELETESTR(a)
    	If 'a' isn't null, calls 'delete' on it.

Back to the top of CStrA

### CStrA( JNIEnv *pEnv, jstring pStr );

Construct from an JNI string. Only available in JNI builds.

    	CStrA( JNIEnv *pEnv, jstring pStr );

Back to the top of CStrA

### CStrA( JRIEnv *pEnv, JRIStringID pStr );

Construct from an JRI string. Only available in JRI builds.

    	CStrA( JRIEnv *pEnv, JRIStringID pStr );

Back to the top of CStrA

### CStrA( Hjava_lang_String *ps );

Construct from an RNI string. Only available in RNI builds.

    	CStrA( Hjava_lang_String *ps );

Back to the top of CStrA

### CStrA( long len );

Construct with an internal buffer able to hold 'len' characters ( buffer may be > 'len' bytes ).

    	CStrA( long len );

Back to the top of CStrA

### CStrA( const char *s );

Construct from a C string

    	CStrA( const char *s );

Back to the top of CStrA

### CStrA( const wchar_t *s );

Construct from a Unicode string, converting with WideCharToMultiByte(). Only available in win builds.

    	CStrA( const wchar_t *s );

Back to the top of CStrA

### CStrA( const CStrA *cs );

Construct from another CStrA.

    	CStrA( const CStrA *cs );

Back to the top of CStrA

### ~CStrA();

Destructor.

    	virtual	~CStrA();

Back to the top of CStrA

### jstring getJString( JNIEnv *pEnv );

Convert to an JNI String. Only available in JNI builds.

    	virtual	jstring	getJString( JNIEnv *pEnv );

Back to the top of CStrA

### JRIStringID getJString( JRIEnv *pEnv );

Convert to an JRI String. Only available in JRI builds.

    	virtual	JRIStringID	getJString( JRIEnv *pEnv );

Back to the top of CStrA

### Hjava_lang_String *getJString();

Convert to an RNI String. Only available in RNI builds.

    	virtual	Hjava_lang_String *getJString();

Back to the top of CStrA

### char *getBuf() const;

Returns a pointer to the character buffer.

    	virtual	char	*getBuf() const;

Back to the top of CStrA

### long getLength() const;

Returns the length of the string.

    	virtual	long	getLength() const;

Back to the top of CStrA

### void toUpper();

Converts the string to upper case.

    	virtual	void	toUpper();

Back to the top of CStrA

### void toLower();

Converts the string to lower case.

    	virtual	void	toLower();

Back to the top of CStrA

### void setBuf( const char *s );

Copies the given string into this object, expanding the internal buffer as necessary.

in s
  The null-terminated string to copy into this object.

    	virtual	void	setBuf( const char *s );

Back to the top of CStrA

### void setBuf( const CStrA *cs );

Copies the given CStrA into this object, expanding the internal buffer as necessary.

in cs
  The buffer of this object will be copied into this object.

    	virtual	void	setBuf( const CStrA *cs );

Back to the top of CStrA

### void ensureCharCapacity( long cap );

Ensures that this object's internal buffer can contain the given number of characters.

in cap
  The new number of characters.

    	virtual	void	ensureCharCapacity( long cap );

Back to the top of CStrA

### long getCharCapacity() const;

Returns the number of characters this object's buffer can hold.

    	virtual	long	getCharCapacity() const;

Back to the top of CStrA

### long getByteCapacity() const;

Returns the number of bytes this object's buffer can hold.

    	virtual	long	getByteCapacity() const;

Back to the top of CStrA

### void concat( const char *s );

Concatenates the given string, expanding the internal buffer as necessary.

in s
  The string to concat.

    	virtual	void	concat( const char *s );

Back to the top of CStrA

### void concat( const CStrA *cs );

Concatenates the given string, expanding the internal buffer as necessary.

in s
  The string to concat.

    	virtual	void	concat( const CStrA *cs );

Back to the top of CStrA

### void truncateAt( long wh );

Shortens this string.

in wh
  The new end location of this string

    	virtual	void	truncateAt( long wh );

Back to the top of CStrA

### BOOL contains( const CStrA *cs ) const;

Returns TRUE if this string contains 'cs', FALSE otherwise. Case significant.

in cs
  The string to be searched for.

    	virtual	BOOL	contains( const CStrA *cs ) const;

Back to the top of CStrA

### BOOL contains( const char *s ) const;

Returns TRUE if this string contains 's', FALSE otherwise. Case significant.

in s
  The string to be searched for.

    	virtual	BOOL	contains( const char *s ) const;

Back to the top of CStrA

### BOOL startsWith( const CStrA *cs ) const;

Returns TRUE if this string starts with the given string, FALSE otherwise.

in cs
  The string to search for.

    	virtual	BOOL	startsWith( const CStrA *cs ) const;

Back to the top of CStrA

### BOOL startsWith( const char *s ) const;

Returns TRUE if this string starts with the given string, FALSE otherwise.

in s
  The string to search for.

    	virtual	BOOL	startsWith( const char *s ) const;

Back to the top of CStrA

### BOOL isEqual( const CStrA *cs ) const;

Returns TRUE if this string equals the given string, FALSE otherwise. Case sensitive.

in cs
  The string to compare.

    	virtual	BOOL	isEqual( const CStrA *cs ) const;

Back to the top of CStrA

### BOOL isEqual( const char *s ) const;

Returns TRUE if this string equals the given string, FALSE otherwise. Case sensitive.

in s
  The string to compare.

    	virtual	BOOL	isEqual( const char *s ) const;

Back to the top of CStrA

### BOOL isEqualIgnoreCase( const CStrA *cs ) const;

Returns TRUE if this string equals the given string, FALSE otherwise. Not case sensitive.

in cs
  The string to compare.

    	virtual	BOOL	isEqualIgnoreCase( const CStrA *cs ) const;

Back to the top of CStrA

### BOOL isEqualIgnoreCase( const char *s ) const;

Returns TRUE if this string equals the given string, FALSE otherwise. Not case sensitive.

in s
  The string to compare.

    	virtual	BOOL	isEqualIgnoreCase( const char *s ) const;

Back to the top of CStrA

### void copyInto( char *s );

Copies this string into the given character buffer, which is assumed to be long enough to hold this string.

out s
  Where to copy this string..

    	virtual	void	copyInto( char *s );

Back to the top of CStrA

### long replaceFrom( long startIndex, const char *searchString, const CStrA *csReplace );

Searches for a substring, and, if found, replaces with another string. Returns -1 if the string couldn't be found, a positive index otherwise. The index can be used with subsequent calls.

in startIndex
  The index in this string at which to start searching.
in searchString
  The string to be searched for.
in csReplace
  If the string is found, it will be replaced with this string.

    	virtual	long	replaceFrom( long startIndex, const char *searchString, const CStrA *csReplace );

Back to the top of CStrA

### BOOL isSubstringOf( const char *s ) const;

Returns TRUE if this is a substring of the given string, FALSE otherwise.

    	virtual	BOOL	isSubstringOf( const char *s ) const;

Back to the top of CStrA

### BOOL extractExeFileName( CStrA *csDest );

If this string contains the full path of an .exe file, places it in csDest. Returns TRUE if it succeeds, FALSE otherwise.

out csDest
  Destination of the exe file name.

    	virtual	BOOL	extractExeFileName( CStrA *csDest );

Back to the top of CStrA

### void formatInt( const char *lpszFormat, long num );

Uses sprintf to write an integer into this string. The string must be at least 10 characters long.

in lpszFormat
  The printf-style format of the integer.
in num
  The integer.

    	virtual	void	formatInt( const char *lpszFormat, long num );

Back to the top of CStrA

### long countPackedStrings( const CStrA *ps );

Returns the number of strings in the given packed string. See getPackedString for a description of the format of packed strings.

in ps
  The packed string.

    	static	long	countPackedStrings( const CStrA *ps );

Back to the top of CStrA

### CStrA *getPackedString( const CStrA *ps, long i );

Returns a CStrA containing the i'th string in the given packed string. Returns NULL if that string could not be found. A "packed" string consists of a series of null-terminated c strings, followed by a null character. If represents the null character, a packed string containing "a", "b", and "c" looks like: abc The packed string methods are provided for use with such WinAPI routines as GetLogicalDriveStrings()

in ps
  The packed string.
in i
  Which string to return; 0-based.

    	static	CStrA	*getPackedString( const CStrA *ps, long i );

Back to the top of CStrA

## All Members

public:
  jstring getJString( JNIEnv *pEnv );
  JRIStringID getJString( JRIEnv *pEnv );
  Hjava_lang_String *getJString();
  char *getBuf() const;
  long getLength() const;
  void toUpper();
  void toLower();
  void setBuf( const char *s );
  void setBuf( const CStrA *cs );
  void ensureCharCapacity( long cap );
  long getCharCapacity() const;
  long getByteCapacity() const;
  void concat( const char *s );
  void concat( const CStrA *cs );
  void truncateAt( long wh );
  BOOL contains( const CStrA *cs ) const;
  BOOL contains( const char *s ) const;
  BOOL startsWith( const CStrA *cs ) const;
  BOOL startsWith( const char *s ) const;
  BOOL isEqual( const CStrA *cs ) const;
  BOOL isEqual( const char *s ) const;
  BOOL isEqualIgnoreCase( const CStrA *cs ) const;
  BOOL isEqualIgnoreCase( const char *s ) const;
  void copyInto( char *s );
  long replaceFrom( long startIndex, const char *searchString, const CStrA *csReplace );
  BOOL isSubstringOf( const char *s ) const;
  BOOL extractExeFileName( CStrA *csDest );
  void formatInt( const char *lpszFormat, long num );
  static long countPackedStrings( const CStrA *ps );
  static CStrA *getPackedString( const CStrA *ps, long i );
protected:

Back to the top of CStrA

## Ancestors

Class does not inherit from any other class.

Back to the top of CStrA

## Descendants

Class is not inherited by any others.

Back to the top of CStrA

Generated from source by the Cocoon utilities on Mon May 28 10:10:47 2001 .

Main Page · JConfig · ImageMeister · System Properties Repository · WordMeister · Free Samples · Java Freeware · Contact Us · FAQ · Links

Copyright (c) 1997,1998,1999,2000 Samizdat Productions. All Rights Reserved.
WarpMovie, TileMovie, JConfig, ImageMeister and MovieShredder are Trademarks of Samizdat Productions.