Exemple #1
0
 //! \brief Return if two any objects are the same or not. 
 bool same( const any &other ) const
   {
     if( this->empty() && other.empty() )
       return true;
     else if( this->empty() && !other.empty() )
       return false;
     else if( !this->empty() && other.empty() )
       return false;
     // !this->empty() && !other.empty()
     return content->same(*other.content);
   }
Exemple #2
0
/* set a named property */
bool GemState::set(const GemState::key_t key, any value) {
  if(value.empty()) {
    data->data.erase(key);
    return false;
  }

  /* wrapper for DEPRECATED access to member variables */
  if(1) {
    try {
      switch(key) {
      case(_DIRTY): dirty=gem::any_cast<bool>(value); break;
      case(_PIX): image=gem::any_cast<pixBlock*>(value); break;
      case(_GL_TEX_NUMCOORDS): numTexCoords=gem::any_cast<int>(value); break;
      case(_GL_TEX_COORDS): texCoords=gem::any_cast<TexCoord*>(value); break;
      case(_GL_LIGHTING): lighting=gem::any_cast<bool>(value); break;
      case(_GL_SMOOTH): smooth=gem::any_cast<bool>(value); break;
      case(_GL_TEX_TYPE): texture=gem::any_cast<int>(value); break;
      case(_GL_TEX_UNITS): multiTexUnits=gem::any_cast<int>(value); break;
      case(_TIMING_TICK): tickTime=gem::any_cast<float>(value); break;
      case(_GL_DRAWTYPE): drawType=gem::any_cast<GLenum>(value); break;
      case(_GL_DISPLAYLIST): inDisplayList=gem::any_cast<bool>(value); break;
      default: break;
      }
    } CATCH_ANY(key);
  }
  data->data[key]=value;
  return true;
}
Exemple #3
0
void test_default_ctor()
{
    const any value;

    check_true(value.empty(), "empty");
    check_null(any_cast<int>(&value), "any_cast<int>");
    check_equal(value.type(), typeid(void), "type");
}
Exemple #4
0
void test_null_copying()
{
    const any null;
    any copied = null, assigned;
    assigned = null;

    check_true(null.empty(), "empty on null");
    check_true(copied.empty(), "empty on copied");
    check_true(assigned.empty(), "empty on copied");
}
Exemple #5
0
bool is_empty(any<has_empty<bool(), const _self>, const _self&> x) {
    return x.empty();
}