home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
csso0301.zip
/
SAMPLES
/
CPP-API
/
SOURCE
/
KCTSTLIB.CPP
< prev
next >
Wrap
Text File
|
2000-02-15
|
2KB
|
63 lines
/* Copyright (c) 1998-2000 IBK-Landquart-Switzerland. All rights reserved.
*
* Module : KcTstLib.CPP
* Application : CSS Sample Library
* Author : Peter Koch, IBK
*
* Date Description Who
* --------------------------------------------------------------------------
* Jan 1998 First release P.Koch, IBK
* Feb 2000 Revised P.Koch, IBK
*/
#include <strstrea.h>
#include <KCss.hpp>
static IString myStrReverse(KCss* css)
{
return IString(css->get("string").reverse());
}
static IString mySubString(KCss* css)
{
int argc = css->get("argCount").asInt();
switch (argc) {
case 2:
return css->get("string").subString(
css->get("start").asInt()
);
case 3:
return css->get("string").subString(
css->get("start").asInt(),
css->get("count").asInt()
);
default:
return css->get("string").subString(
css->get("start").asInt(),
css->get("count").asInt(),
css->get("padchar")[1]
);
} // switch
} // mySubString
void _Export initialize(KCss* css)
{
IString iFile("KcMyLib.dll");
istrstream init("const myVersion = 0.1;\n");
css->loadScript(iFile, &init);
(*css)
.addFunc(
iFile,
"myStrReverse(const string)",
myStrReverse)
.addFunc(
iFile,
"mySubString(const string, const start, [const count, const padchar])",
mySubString);
} // initialize
void _Export cleanup(KCss* css)
{
} // cleanup