source: cpp/gdk/syntparam.cpp @ 100

Last change on this file since 100 was 81, checked in by Maciej Komosinski, 12 years ago

improved parsing of properties (e.g. in f0 genotypes)

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// This file is a part of the Framsticks GDK library.
2// Copyright (C) 2002-2011  Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#include "nonstd.h"
6#include "syntparam.h"
7#include "paramobj.h"
8#include <math.h>
9
10SyntParam::SyntParam(ParamEntry *init_pe,SString* autostr,bool handle_defaults_when_saving)
11        :autostring(autostr)
12{
13Param::setParamTab(init_pe);
14pe=ParamObject::makeParamTab(this);
15Param::setParamTab(pe);
16if (handle_defaults_when_saving)
17        {
18        def_obj=ParamObject::makeObject(pe);
19        Param::select(def_obj);
20        Param::setDefault();
21        }
22else
23        def_obj=NULL;
24obj=ParamObject::makeObject(pe);
25Param::select(obj);
26Param::setDefault();
27revert();
28}
29
30SyntParam::SyntParam(const SyntParam& src)
31        :autostring(src.autostring)
32{
33Param::setParamTab(src.pe);
34pe=ParamObject::makeParamTab(this);
35Param::setParamTab(pe);
36obj=ParamObject::dupObject(src.obj);
37def_obj=src.def_obj ? ParamObject::dupObject(src.def_obj) : NULL;
38Param::select(obj);
39}
40
41SyntParam::~SyntParam()
42{
43update();
44ParamObject::freeParamTab(pe);
45ParamObject::freeObject(obj);
46ParamObject::freeObject(def_obj);
47}
48
49void SyntParam::update(SString *s)
50{
51if (!s) s=autostring;
52if (s) {*s=""; Param::save2(*s,def_obj,0);}
53}
54
55void SyntParam::revert(SString *s)
56{
57if (!s) s=autostring;
58if (s)  {
59        int p=0;
60        Param::load2(*s,p);
61        }
62}
63
64
65
66
67
Note: See TracBrowser for help on using the repository browser.