SASC-NG
DVBSoftCAM

cOptMInt Class Reference

Inheritance diagram for cOptMInt:

List of all members.

Public Member Functions

 cOptMInt (const char *Name, const char *Title, int *Storage, int Size, int Mode)
virtual ~cOptMInt ()
virtual void Parse (const char *Value)
virtual void Backup (void)
virtual bool Set (void)
virtual void Store (const char *PreStr)
virtual void Create (cOsdMenu *menu)

Protected Attributes

int * storage
int * value
int size
int mode
int len

Detailed Description

Definition at line 387 of file sc.c.


Constructor & Destructor Documentation

cOptMInt::cOptMInt ( const char *  Name,
const char *  Title,
int *  Storage,
int  Size,
int  Mode 
)

Definition at line 403 of file sc.c.

References len, MALLOC, mode, size, storage, and value.

:cOpt(Name,Title)
{
  storage=Storage; size=Size; mode=Mode; len=sizeof(int)*size;
  value=MALLOC(int,size);
}
cOptMInt::~cOptMInt ( ) [virtual]

Definition at line 410 of file sc.c.

References free, and value.

{
  free(value);
}

Member Function Documentation

void cOptMInt::Backup ( void  ) [virtual]

Implements cOpt.

Definition at line 428 of file sc.c.

References len, storage, and value.

{
  memcpy(value,storage,len);
}
void cOptMInt::Create ( cOsdMenu *  menu) [virtual]

Implements cOpt.

Definition at line 452 of file sc.c.

References cOsdMenu::Add(), i, mode, size, cOpt::title, tr, and value.

{
  for(int i=0; i<size; i++) {
    const char *buff=tr(title);
    switch(mode) {
      case 0: menu->Add(new cMenuEditCapItem(buff,&value[i])); break;
      case 1: menu->Add(new cMenuEditIntItem(buff,&value[i],0,65535)); break;
      case 2: menu->Add(new cMenuEditHexItem(buff,&value[i],0,65535)); break;
      }
    if(value[i]==0) break;
    }
}
void cOptMInt::Parse ( const char *  Value) [virtual]

Implements cOpt.

Definition at line 415 of file sc.c.

References i, len, mode, size, and storage.

{
  memset(storage,0,len);
  int i=0;
  while(1) {
    char *p;
    const int c=strtol(Value,&p,mode>1 ? 16:10);
    if(p==Value || i>=size) return;
    if(c>0) storage[i++]=c;
    Value=p;
    }
}
bool cOptMInt::Set ( void  ) [virtual]

Implements cOpt.

Definition at line 433 of file sc.c.

References i, k, len, storage, and value.

{
  if(memcmp(value,storage,len)) {
    memset(storage,0,len);
    for(int i=0, k=0; i<size; i++) if(value[i]>0) storage[k++]=value[i];
    return true;
    }
  return false;
}
void cOptMInt::Store ( const char *  PreStr) [virtual]

Implements cOpt.

Definition at line 443 of file sc.c.

References b, cOpt::FullName(), i, mode, cPlugin::SetupStore(), size, and storage.

{
  char b[256];
  int p=0;
  for(int i=0; i<size; i++)
    if(storage[i] || mode==0) p+=snprintf(b+p,sizeof(b)-p,mode>1 ? "%x ":"%d ",storage[i]);
  ScPlugin->SetupStore(FullName(PreStr),p>0?b:0);
}

Member Data Documentation

int cOptMInt::len [protected]

Definition at line 390 of file sc.c.

Referenced by Backup(), cOptMInt(), Parse(), and Set().

int cOptMInt::mode [protected]

Definition at line 390 of file sc.c.

Referenced by cOptMInt(), Create(), Parse(), and Store().

int cOptMInt::size [protected]

Definition at line 390 of file sc.c.

Referenced by cOptMInt(), Create(), Parse(), and Store().

int* cOptMInt::storage [protected]

Definition at line 389 of file sc.c.

Referenced by Backup(), cOptMInt(), Parse(), Set(), and Store().

int * cOptMInt::value [protected]

Definition at line 389 of file sc.c.

Referenced by Backup(), cOptMInt(), Create(), Set(), and ~cOptMInt().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines