Changeset 200 for cpp/frams


Ignore:
Timestamp:
03/29/14 00:04:01 (10 years ago)
Author:
Maciej Komosinski
Message:

More stl string, less SString

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genman.cpp

    r197 r200  
    88#include "common/framsg.h"
    99#include "common/nonstd_math.h"
     10#include "common/stl-util.h"
    1011#include <frams/errmgr/errmanager.h>
    1112
     
    152153        {
    153154                if (operformats.find(oper_fx_list[i]->supported_format) != -1) continue;
    154                 char tmp[10];
    155                 SString id, name, type = "~";
    156                 type += oper_fx_list[i]->name;
     155                string type = string("~") + oper_fx_list[i]->name;
    157156                int dup = 0;
    158157                for (unsigned int j = i + 1; j < oper_fx_list.size(); j++)
    159158                        if (oper_fx_list[i]->supported_format == oper_fx_list[j]->supported_format)
    160159                        {
    161                                 type += "~"; type += oper_fx_list[j]->name; dup++;
     160                                type += "~";
     161                                type += oper_fx_list[j]->name;
     162                                dup++;
    162163                        }
    163                 sprintf(tmp, "d 0 %d ", dup);
    164                 type = SString(tmp) + type;
    165                 sprintf(tmp, "%c", oper_fx_list[i]->supported_format);
    166                 id = "genoper_f"; id += tmp;
    167                 name = "Operators for f"; name += tmp;
     164                type = ssprintf("d 0 %d ", dup) + type;
     165                string id = ssprintf("genoper_f%c", oper_fx_list[i]->supported_format);
     166                string name = ssprintf("Operators for f%c", oper_fx_list[i]->supported_format);
    168167                seloper[selopercount] = 0;
    169168                operformats += oper_fx_list[i]->supported_format;
    170169                //printf("%x %s %s %s\n",&seloper[selopercount],(const char*)id,(const char*)type,(const char*)name);
    171                 seloperpar.addProperty(&seloper[selopercount++], id, type, name, "", PARAM_READONLY*(dup == 0));
     170                seloperpar.addProperty(&seloper[selopercount++], id.c_str(), type.c_str(), name.c_str(), "", PARAM_READONLY*(dup == 0));
    172171        }
    173172
     
    460459        GenoOperators *gf = getOper_f(format);
    461460        if (!gf) return Geno();
    462         SString info = "The simplest genotype of format f"; info += format;
     461        string info = "The simplest genotype of format f"; info += format;
    463462        info += " for operators '"; info += gf->name; info += "'.";
    464         return Geno(gf->getSimplest(), format, "Root", (const char*)info);
     463        return Geno(gf->getSimplest(), format, "Root", info.c_str());
    465464}
    466465
     
    477476{
    478477        GenoOperators *gf = getOper_f(format);
    479         if (!gf) return "n/a"; else return gf->name;
     478        if (!gf) return "n/a"; else return gf->name.c_str();
    480479}
    481480
     
    534533        for (unsigned int i = 0; i < oper_fx_list.size(); i++)
    535534        {
    536                 SString l;
     535                string l;
    537536                if (oper_fx_list[i]->checkValidity("") != GENOPER_NOOPER) l += " checkValidity";
    538537                if (oper_fx_list[i]->getSimplest())
     
    548547                //      if (oper_fx_list[i]->similarity("","")!=GENOPER_NOOPER) l+=" similarity";
    549548                FMprintf("GenMan", "Report", 0, "format f%c (%s):%s",
    550                         oper_fx_list[i]->supported_format, (const char*)oper_fx_list[i]->name, (const char*)l);
     549                        oper_fx_list[i]->supported_format, oper_fx_list[i]->name.c_str(), l.c_str());
    551550        }
    552551}
Note: See TracChangeset for help on using the changeset viewer.