📄 istring.h
字号:
#ifndef FMESTRING_H
#define FMESTRING_H
// $Id: istring.h,v 17.1 2005/12/20 18:55:51 geh Exp $
/*! \file istring.h
\brief Defines the IFMEString and IFMEStringArray interfaces.
*/
/*! \internal
============================================================================
Name : istring.h
System : FME Developer Kit
Language : C++
Purpose : Declaration of IFMEString and IFMEStringArray
Author Date Changes made
------------------ ------------ -------------------------------
Dale Lutz Aug 08, 1997 Original definition
Graeme Hiebert Dec 18, 1997 Removed IFMEStringArray::removeLast().
Kevin Wiebe Jul 08, 1998 Added methods to set char* without
using NULL termination
Don Murray Jun 25, 1999 Added appendCSVString
Don Murray Jul 09, 1999 Added appendTokenizedString.
Kevin Wiebe Oct 07, 1999 new methods: appendString, getString,
removeAllString, and containsString
Hieu Nguyen Feb 21, 2002 Added getIndex method
Hieu Nguyen Mar 05, 2002 Added operator==(const IFMEString&)
Hieu Nguyen Mar 28, 2002 Removed getIndex and operator==(const IFMEString&)
Tom Weir Jun 01, 2004 Fixed documentation.
Kaustav Mukherjee Nov 16, 2004 Added the internal tag to hide this revision control part.
Aaron Cox Jul 04, 2005 Added appendStringArray() to IFMEStringArray.
Aaron Cox Nov 24, 2005 Removed appendStringArray() from IFMEStringArray.
Copyright (c) 1994 - 2005, Safe Software Inc.
All Rights Reserved
This software may not be copied or reproduced, in all or in part,
without the prior written consent of Safe Software Inc.
The entire risk as to the results and performance of the software,
supporting text and other information contained in this file
(collectively called the "Software") is with the user. Although
Safe Software Incorporated has used considerable efforts in preparing
the Software, Safe Software Incorporated does not warrant the
accuracy or completeness of the Software. In no event will Safe Software
Incorporated be liable for damages, including loss of profits or
consequential damages, arising out of the use of the Software.
*/
/*! \class IFMEString
\brief String class
This class is an abstract string and string array class that are used
to pass character string data between the FME and developer's modules.
The developer's kit also includes an implementation of these
classes, for use in developer's code.
*/
#include "fmetypes.h"
//===========================================================================
// Abstract Interface Class -- all methods are virtual and it has no data
class IFMEString
{
public:
// -----------------------------------------------------------------------
/*! This operator allows a const char * string to be assigned.
// The assigned string <b>MUST</b> be NULL terminated, or undefined
// behaviour will result. */
virtual const char* operator=(const char* stringValue) = 0;
// -----------------------------------------------------------------------
/*! This operator casts the string to a const char * string.
// A pointer to the const char* string is returned, but is owned by the
// string, and is not guaranteed to persist. All callers should make a
// copy if they want the string to persist. */
virtual operator const char*() const = 0;
// -----------------------------------------------------------------------
/*! This method sets the string using a const char* string and a length.
// No null termination assumptions are made. */
virtual void set(const char* stringValue,
const FME_UInt32 length) = 0;
// -----------------------------------------------------------------------
/*! This method returns a pointer to a const char* string representation
// of the string. The string retains ownership of the memory returned, and
// does not guarantee its persistance. Callers should make a copy of the
// data to ensure its persistance. */
virtual const char* data() const = 0;
// -----------------------------------------------------------------------
/*! This method returns the actual length of the string, not including
// null termination. */
virtual FME_UInt32 length() const = 0;
protected:
// -----------------------------------------------------------------------
/* Constructor */
IFMEString() {};
// -----------------------------------------------------------------------
/* Destructor */
virtual ~IFMEString() {};
private:
// Hide methods that we don't want called -- but we leave the door
// open if subclasses want to implement these
// -----------------------------------------------------------------------
/* copy constructor */
IFMEString(const IFMEString&);
// -----------------------------------------------------------------------
/* assignment operator. */
IFMEString& operator=(const IFMEString&);
private:
};
// -----------------------------------------------------------------------
/*! \class IFMEStringArray
\brief String Array class */
// Abstract Interface Class -- all methods are virtual and it has no data
// this is a bare bones, and I mean bare bones, interface.
class IFMEStringArray
{
public:
// -----------------------------------------------------------------------
/*! This method appends a const char* string */
virtual void append(const char* stringValue) = 0;
// -----------------------------------------------------------------------
/*! This method appends an IFMEString string */
virtual void append(const IFMEString& stringValue) = 0;
// -----------------------------------------------------------------------
/*! This operator retrieves the contents of the entry at the specified
// index, which must be between 0 and (entries() - 1). */
virtual const char* operator()(FME_UInt32 index) const = 0;
// -----------------------------------------------------------------------
/*! This method retrieves the contents of the entry at the specified
// index, which must be between 0 and (entries() - 1). */
virtual FME_MsgNum getElement(const FME_UInt32 index, IFMEString& element) = 0;
// -----------------------------------------------------------------------
/*! This method sets the entry at the specified index, which must be
// between 0 and entries() - 1) */
virtual FME_MsgNum setElement(const FME_UInt32 index, const IFMEString& element) = 0;
// -----------------------------------------------------------------------
/*! This method returns the number of entries in the array */
virtual FME_UInt32 entries() const = 0;
// -----------------------------------------------------------------------
/*! This method removes all entries from the array */
virtual void clear() = 0;
// -----------------------------------------------------------------------
/*! This method performs a linear search of the array for the specified string */
virtual FME_Boolean contains(const char* stringValue) const = 0;
// -----------------------------------------------------------------------
/*! This method performs a linear search of the array for the specified string */
virtual FME_Boolean contains(const IFMEString& stringValue) const = 0;
// -----------------------------------------------------------------------
/*! This method splits a string into segments using a provided delimeter
// string. Each segment is appended to the string array. */
virtual void appendCSVString(const char* csvString,
const char* delimiter) = 0;
// -----------------------------------------------------------------------
/*! This method splits a string into segments using one or more of the
// tokens provided. No null entries will be placed in the array. */
virtual void appendTokenizeString(const char* tokenString,
const char* tokenSeparators) = 0;
// -----------------------------------------------------------------------
/*! This method Removes all items that are equal to the provided string,
// and returns the number of strings removed. */
virtual FME_UInt32 removeAll(const char* stringValue) = 0;
// -----------------------------------------------------------------------
/*! This method Removes all items that are equal to the provided string,
// and returns the number of strings removed. */
virtual FME_UInt32 removeAll(const IFMEString& stringValue) = 0;
protected:
// -----------------------------------------------------------------------
// No one should be creating an instance of this directly, so we
// make the constructor protected.
IFMEStringArray() {};
// -----------------------------------------------------------------------
// Destructor
virtual ~IFMEStringArray() {};
private:
// Hide methods that we don't want called -- but we leave the door
// open if subclasses want to implement these
//---------------------------------------------------------------
// copy constructor
IFMEStringArray(const IFMEStringArray&);
//---------------------------------------------------------------
// assignment operator.
IFMEStringArray& operator=(const IFMEStringArray&);
private:
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -