Last change
on this file since 107 was
104,
checked in by sz, 12 years ago
|
introducing object de/serialization - see serialtest.cpp
the core GDK classes can be now used in multiple threads (ifdef MULTITHREADED)
|
-
Property svn:eol-style set to
native
|
File size:
980 bytes
|
Rev | Line | |
---|
[104] | 1 | // This file is a part of the Framsticks GDK library. |
---|
| 2 | // Copyright (C) 2002-2013 Szymon Ulatowski. See LICENSE.txt for details. |
---|
| 3 | // Refer to http://www.framsticks.com/ for further information. |
---|
| 4 | |
---|
| 5 | #include "stderrors.h" |
---|
| 6 | #include "sstringutils.h" |
---|
| 7 | #include "framsg.h" |
---|
| 8 | |
---|
| 9 | bool listIndexCheck(SList* list,int index,char* msgobj,char* msgfun) |
---|
| 10 | { |
---|
| 11 | int size=list->size(); |
---|
| 12 | if ((index<0)||(index>=size)) |
---|
| 13 | { |
---|
| 14 | if (size>0) |
---|
| 15 | FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1); |
---|
| 16 | else |
---|
| 17 | FMprintf(msgobj,msgfun,FMLV_ERROR,"Invalid index %d (this list is empty)",index); |
---|
| 18 | return 0; |
---|
| 19 | } |
---|
| 20 | return 1; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | SString stringCheck(SString& in,char* msgobj,char* msgfun,char* msg,SString (*checker)(SString& in)) |
---|
| 24 | { |
---|
| 25 | if (!checker) |
---|
| 26 | checker=trim; |
---|
| 27 | SString corrected=checker(in); |
---|
| 28 | if (corrected!=in) |
---|
| 29 | { |
---|
| 30 | SString msg2=SString(msg)+": \"%s\" (adjusted to \"%s\")"; |
---|
| 31 | FMprintf(msgobj,msgfun,FMLV_WARN,(const char*)msg2,(const char*)in,(const char*)corrected); |
---|
| 32 | } |
---|
| 33 | return corrected; |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.