예제 #1
0
CubitString CubitCoordinateSystem::entity_name() const
{
  CubitString name = class_name();
  name += " ";
  name += CubitString( this->id() );
  return name;
}
예제 #2
0
CubitString CubitSimpleAttrib::character_type() const //- returns the type of attribute
{
  if(stringDataList.size() >= 1 )
  {
    return stringDataList[0];
  }
  return CubitString();
}
예제 #3
0
  // read from file starting at current file offset
FacetAttrib* FacetAttrib::restore(FILE *restore_file, unsigned int endian)
{
  if( restore_file == NULL )
    return NULL;

  NCubitFile::CIOWrapper wrapper(endian, restore_file );

  // write a version number for the attribute data
  unsigned int version;
  wrapper.Read(&version, 1);

  // haven't handled any version changes yet
  if( version != 1 )
  {
    PRINT_ERROR("Wrong FacetAttrib version : %u\n", version );
    return NULL;
  }

  // read the number of strings, number of doubles, and number of integers
  int counts[3];
  wrapper.Read(reinterpret_cast<unsigned int*>(counts), 3);
  int n_strings = counts[0];
  int n_doubles = counts[1];
  int n_ints = counts[2];
  
    // allocate arrays, but don't try to allocate zero-length array
  CubitString* strings = n_strings ? new CubitString[n_strings] : NULL;
  double *doubles = n_doubles ? new double[n_doubles] : NULL;
  int *ints = n_ints ? new int[n_ints] : NULL;
  
  // read the string data
  int i;
  for( i = 0; i < n_strings; i++ )
    strings[i] = CubitString(wrapper.Read());

  // write the doubles
  wrapper.Read(doubles, n_doubles);

  // write the integers
  wrapper.Read(reinterpret_cast<unsigned int*>(ints), n_ints);

  return new FacetAttrib(n_strings, strings, n_doubles, doubles, n_ints, ints);
}
예제 #4
0
CubitString CubitString::substr(size_t first, size_t count) const
{
  size_t len = length();
  if (first >= len)
    return CubitString();

  if (first == 0 && count >= len)
    return *this;
  
  if (count > len - first)
    count = len - first;
  
  CubitString rv;
  if (count > 0)
  {
    char *substring = new char[count+1];
    strncpy(substring, rep->chars+first, count);
    substring[count] = '\0';
    rv = substring;
    delete [] substring;
  }
  return rv;
}
예제 #5
0
CubitString CubitString::segmentstr(size_t first, size_t first_not) const
{
  if (first_not <= first)
    return CubitString();
  return substr(first, first_not - first);
}
예제 #6
0
CubitString operator+(const char *c1, const CubitString& s2)
{
  return CubitString(c1) += s2;
}
예제 #7
0
CubitString operator+(const CubitString& s1, const char *c2)
{
  return CubitString(s1) += c2;
}
예제 #8
0
CubitString operator+(const CubitString& s1, const CubitString& s2)
{
  return CubitString(s1) += s2;
}
예제 #9
0
CubitString CubitUtil::getenv(const CubitString& var)
{
  return CubitString(::getenv(var.c_str()));
}
예제 #10
0
CubitString RefEntityName::get_replacement_setting()
{
  char tmp[] = {replacementCharacter, '\0'};
  return CubitString(tmp);
}
예제 #11
0
CubitString RefEntityName::get_suffix_setting()
{
  char tmp[] = {suffixCharacter, '\0'};
  return CubitString(tmp);
}