Beispiel #1
0
void WRAPPEDPARAM::addByteBufferWrapper(const Param& buffer,
                                        vector& wrappedParams,
                                        PackageList& packageList)
{
    new WrappedParam("$Buffer", buffer.getName(), wrappedParams, NULL,
                     packageList);
    new WrappedParam("$Size", buffer.getName(), wrappedParams, NULL,
                     packageList);
}
Beispiel #2
0
void WRAPPEDPARAM::addByteBufferWrapperWithOffset(const Param& buffer,
                                                  vector& wrappedParams,
                                                  PackageList& packageList)
{
    new WrappedParam("$BufferWithOffset", buffer.getName(), wrappedParams, NULL,
                     packageList);
    new WrappedParam("$BufferOffset", buffer.getName(), wrappedParams, NULL,
                     packageList);
    new WrappedParam("$BufferLength", buffer.getName(), wrappedParams, NULL,
                     packageList);
}
Beispiel #3
0
void WRAPPEDPARAM::addDirectWrapper(const Param& param,
                                    const Type* paramType,
                                    vector& wrappedParams,
                                    PackageList& packageList)
{
    new WrappedParam(paramType->getBaseJavaName(), param.getName(), 
                     wrappedParams, paramType, packageList);
}
Beispiel #4
0
void Comments::setWay(string way,string paramName)
{
    Param *current;
    for(int i = 0;i<_fctParameters.size();i++) {
        current = _fctParameters[i];
        if(current->getName()==paramName)
            current->setWay(getWay(way)); // Uses getWay() function from Way.cpp
    }
    
}
Beispiel #5
0
short SetParam::process(SqlciEnv * sqlci_env)
{
  if (get_arglen() == -1)
    {
      // set param to null value
      Param * param = sqlci_env->get_paramlist()->get(param_name);
      if (param)
	param->makeNull();
      else
	{
	  param = new Param(param_name, (char*)0);
	  
	  sqlci_env->get_paramlist()->append(param);
	  param->makeNull();
	}
    }
  else
    if (!get_argument())
    {
      /* RESET PARAM command */
      if (!param_name)
	{
	  /* RESET all params */
	  Param * param = sqlci_env->get_paramlist()->getFirst();
	  while (param)
	    {
	      sqlci_env->get_paramlist()->remove(param->getName());
	      delete param;
	      param = sqlci_env->get_paramlist()->getNext();
	    }
	}
      else
	{
	  Param * param = sqlci_env->get_paramlist()->get(param_name);
	  sqlci_env->get_paramlist()->remove(param_name);
	  delete param;
	 }
    } 
  else
    {
      /* SET PARAM command */
      Param * param = sqlci_env->get_paramlist()->get(param_name);
      if (param) {
	param->setValue(this);
      } else
	{
	  param = new Param(param_name, this);
	  
	  sqlci_env->get_paramlist()->append(param);
	}
    }
  
  return 0;
}
Beispiel #6
0
void WRAPPEDPARAM::addStructureWrapper(
        const Param& structure,
        const Type* currentType,
        vector& wrappedParams,
        PackageList& packageList)
{
    addDirectWrapper(structure, currentType, wrappedParams,
                    packageList);
    new WrappedParam(
            "$StructureSize",
            structure.getName(),
            wrappedParams,
            NULL,
            packageList);
}                                 
Beispiel #7
0
short SetPattern::process(SqlciEnv * sqlci_env)
{
  if (!get_argument())
    {
      /* RESET PATTERN command */
      if (!pattern_name)
	{
	  /* RESET all patterns */
	  Param * pattern = sqlci_env->get_patternlist()->getFirst();
	  while (pattern)
	    {
	      sqlci_env->get_patternlist()->remove(pattern->getName());
	      delete pattern;
	      pattern = sqlci_env->get_patternlist()->getNext();
	    }
	}
      else
	{
	  Param * pattern = sqlci_env->get_patternlist()->get(pattern_name);
	  sqlci_env->get_patternlist()->remove(pattern_name);
	  delete pattern;
	}
    } 
  else
    {
      /* SET PATTERN command */
      Param * pattern = sqlci_env->get_patternlist()->get(pattern_name);
      if (pattern)
      {
	pattern->setValue(get_argument(), sqlci_env->getTerminalCharset());
      }
      else
	{
	  pattern = new Param(pattern_name, get_argument());
	  
	  sqlci_env->get_patternlist()->append(pattern);
	}
    }
  
  return 0;
}
Beispiel #8
0
Param::Param(const Param &other)
    : m_childNodes()
    , m_parentNode(nullptr)
    , m_name(other.getName())
    , m_data(other.asStdString(""))
{
    // Loop through other and recreate the param tree (Depth first)
    std::function<void(Param&, const Param&)> copyParam = [&](Param &parent, const Param &oParam)
    {
        for(const auto &child : oParam.m_childNodes)
        {
            Param& newNode = parent.push(child.second.get()->getName());

            copyParam(newNode, *child.second.get());
        }

        parent.m_data = oParam.asStdString();
        parent.m_name = oParam.getName();
    };

    copyParam(*this, other);
}
short Reset::reset_pattern(SqlciEnv * sqlci_env)
{
  if (!get_argument())
    {
      /* RESET all patterns */
      Param * pattern = sqlci_env->get_patternlist()->getFirst();
      while (pattern)
	{
	  sqlci_env->get_patternlist()->remove(pattern->getName());
	  pattern = sqlci_env->get_patternlist()->getNext();
	}
    }
  else
    {
      Param * pattern = sqlci_env->get_patternlist()->get(get_argument());
      if (pattern)
	{
	  sqlci_env->get_patternlist()->remove(get_argument());
	}
    }
  
  return 0;
}