示例#1
0
  //
  // Process a CreateCursor scope
  //
  void ProcessCreateCursor(FScope *fScope)
  {
    // Cursor name is first argument
    const char *name = fScope->NextArgString();

    // Cursor class is second argument
    const char *cls  = fScope->NextArgString();

    // Create the cursor
    Base *newCrs = NULL;
    U32 key = Crc::CalcStr(cls);

    switch (key)
    {
      case 0x5B2A0A5F: // "Null"
        newCrs = new Base;
        break;

      case 0xE04B5BBC: // "Bitmap"
        newCrs = new Bmp;
        break;

      case 0xE5A51519: // "Geometric"
        newCrs = new Geometric;
        break;

      default:
      {
        Base *derived;

        if ((derived = cursors.Find(key)) != NULL)
        {
          newCrs = new Derived(derived);
        }
        else
        {
          LOG_ERR(("Unknown Cursor Class [%s]", cls));
          return;
        }
        break;
      }
    }

    // Configure the cursor
    newCrs->Configure(fScope);

    // Add it to the list
    cursors.Add(Crc::CalcStr(name), newCrs);
  }