source: cpp/gdk/paramtabobj.cpp @ 104

Last change on this file since 104 was 66, checked in by Maciej Komosinski, 13 years ago

set 'eol-style' to 'native'

  • Property svn:eol-style set to native
File size: 883 bytes
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 "paramtabobj.h"
6
7int ParamTab::measureTab(const ParamEntry *pe)
8{
9int i=0;
10while(pe->id) {i++;pe++;}
11return i;
12}
13
14void ParamTab::resize(int s)
15{
16if (s==siz) return;
17tab=(ParamEntry*)realloc(tab,sizeof(ParamEntry)*(s+1));
18siz=s;
19}
20
21int ParamTab::add(const ParamEntry* p,int count)
22{
23if (count<0) count=measureTab(p);
24resize(siz+count);
25memmove(tab+siz-count,p,sizeof(ParamEntry)*count);
26memset(tab+siz,0,sizeof(ParamEntry));
27if (siz>0) tab[0].flags=siz-tab[0].group;
28return siz-1;
29}
30
31void ParamTab::remove(int i,int count)
32{
33memmove(tab+i,tab+i+count,sizeof(ParamEntry)*count);
34resize(siz-count);
35memset(tab+siz,0,sizeof(ParamEntry));
36if (siz>0) tab[0].flags=siz-tab[0].group;
37}
38
Note: See TracBrowser for help on using the repository browser.