home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
kcss0012.zip
/
SAMPLES
/
API
/
LIBRARY
/
KCMYLIB.CPP
next >
Wrap
C/C++ Source or Header
|
1998-02-07
|
2KB
|
62 lines
/* Copyright (c) 1998 IBK-Landquart-Switzerland. All rights reserved.
*
* Module : KcMyLib.CPP
* Application : CSS Sample Library
* Author : Peter Koch, IBK
*
* Date Description Who
* --------------------------------------------------------------------------
* Jan 1998 First release 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 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 cleanup(KCss* css)
{
} // cleanup