当前位置: 首页>>代码示例>>C++>>正文


C++ CharacterData类代码示例

本文整理汇总了C++中CharacterData的典型用法代码示例。如果您正苦于以下问题:C++ CharacterData类的具体用法?C++ CharacterData怎么用?C++ CharacterData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CharacterData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runTest

   /*
    * Runs the test case.
    */
   void runTest()
   {
      Document doc;
      NodeList elementList;
      Element testEmployee;
      Node firstC;
      String childName;
      int nodeType;
      CharacterData employeeIDNode;
      String employeeID;
      doc = (Document) baseT::load("hc_staff", false);
      elementList = doc.getElementsByTagName(SA::construct_from_utf8("p"));
      testEmployee = (Element) elementList.item(3);
      firstC = testEmployee.getFirstChild();
      nodeType = (int) firstC.getNodeType();
      
    while (baseT::equals(3, nodeType)) {
    firstC = firstC.getNextSibling();
      nodeType = (int) firstC.getNodeType();
      
    }
childName = firstC.getNodeName();
      baseT::assertEquals("em", childName, __LINE__, __FILE__);
  employeeIDNode = (CharacterData) firstC.getFirstChild();
      employeeID = employeeIDNode.getNodeValue();
      baseT::assertEquals("EMP0004", employeeID, __LINE__, __FILE__);
  
   }
开发者ID:QuentinFiard,项目名称:arabica,代码行数:31,代码来源:hc_elementgetelementsbytagnameaccessnodelist.hpp

示例2: reply

void ChatHandler::handleGuildMemberLevelChange(ChatClient &client,
                                               MessageIn &msg)
{
    // get the guild, the user to change the permissions, and the new permission
    // check theyre valid, and then change them
    MessageOut reply(CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE);
    short guildId = msg.readInt16();
    std::string user = msg.readString();
    short level = msg.readInt8();
    Guild *guild = guildManager->findById(guildId);
    CharacterData *c = storage->getCharacter(user);

    if (guild && c)
    {
        int rights = guild->getUserPermissions(c->getDatabaseID()) | level;
        if (guildManager->changeMemberLevel(&client, guild, c->getDatabaseID(),
                                            rights) == 0)
        {
            reply.writeInt8(ERRMSG_OK);
            client.send(reply);
        }
    }

    reply.writeInt8(ERRMSG_FAILURE);
    client.send(reply);
}
开发者ID:Ablu,项目名称:manaserv,代码行数:26,代码来源:guildhandler.cpp

示例3: applyData

void CharacterData::applyData(CharacterData data, CharacterData originalData)
{
    this->attack=data.attack;
    this->attack = MAX(this->attack,0);
    
    this->defense=data.defense;
    this->defense = MAX(this->defense,0);
    
    this->speed=data.speed;
    this->speed = MAX(this->speed,0);
    
    this->jumpHeight=data.jumpHeight;
    this->jumpHeight = MAX(this->jumpHeight,0);
    
    this->attackSpeed=data.attackSpeed;
    this->attackSpeed = MAX(this->attackSpeed,0);
    
    this->maxJumpTimes=data.maxJumpTimes;
    this->maxJumpTimes = MAX(this->maxJumpTimes,0);
    
    if(data.getHealth()>0)
    {
        this->health+= data.health;
        this->health = MIN(this->health,originalData.getHealth());
    }
    else
    {
        this->health+= MIN((data.getHealth()+this->getDefense()),0);
    }
        //    this->health = MAX(this->health,0);
}
开发者ID:quinsmpang,项目名称:TinyZodiacs,代码行数:31,代码来源:CharacterData.cpp

示例4: currentNode

void HTMLConstructionSite::insertTextNode(const String& characters)
{
    AttachmentSite site;
    site.parent = currentNode();
    site.nextChild = 0;
    if (shouldFosterParent())
        findFosterSite(site);

    unsigned currentPosition = 0;

    // FIXME: Splitting text nodes into smaller chunks contradicts HTML5 spec, but is currently necessary
    // for performance, see <https://bugs.webkit.org/show_bug.cgi?id=55898>.

    Node* previousChild = site.nextChild ? site.nextChild->previousSibling() : site.parent->lastChild();
    if (previousChild && previousChild->isTextNode()) {
        // FIXME: We're only supposed to append to this text node if it
        // was the last text node inserted by the parser.
        CharacterData* textNode = static_cast<CharacterData*>(previousChild);
        currentPosition = textNode->parserAppendData(characters.characters(), characters.length(), Text::defaultLengthLimit);
    }

    while (currentPosition < characters.length()) {
        RefPtr<Text> textNode = Text::createWithLengthLimit(site.parent->document(), characters, currentPosition);
        // If we have a whole string of unbreakable characters the above could lead to an infinite loop. Exceeding the length limit is the lesser evil.
        if (!textNode->length())
            textNode = Text::create(site.parent->document(), characters.substring(currentPosition));

        currentPosition += textNode->length();
        ASSERT(currentPosition <= characters.length());
        attachAtSite(site, textNode.release());
    }
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:32,代码来源:HTMLConstructionSite.cpp

示例5:

EveApi::CharacterData::CharacterData ( const CharacterData& other ):
_name(other.name()),
_characterID(other.characterID()),
_corporationName(other.corporationName()),
_corporationID(other.corporationID())
{
}
开发者ID:sjagoe,项目名称:evemanager,代码行数:7,代码来源:charactersdata.cpp

示例6: GetSourceFrameForCharacter

 SourceFrame BitmapFont::GetSourceFrameForCharacter(char aCharacter)
 {
     CharacterData* characterData = m_CharacterData[aCharacter];
     if(characterData != nullptr)
     {
         return characterData->GetSourceFrame();
     }
     return SourceFrame(0.0f, 0.0f, 0.0f, 0.0f);
 }
开发者ID:Epidilius,项目名称:PhysicsHackAndSlash,代码行数:9,代码来源:BitmapFont.cpp

示例7: GetBearingYForCharacter

 char BitmapFont::GetBearingYForCharacter(char aCharacter)
 {
     CharacterData* characterData = m_CharacterData[aCharacter];
     if(characterData != nullptr)
     {
         return (char)characterData->GetOffset().y;
     }
     return 0;
 }
开发者ID:Epidilius,项目名称:PhysicsHackAndSlash,代码行数:9,代码来源:BitmapFont.cpp

示例8: GetAdvanceXForCharacter

 unsigned short BitmapFont::GetAdvanceXForCharacter(char aCharacter)
 {
     CharacterData* characterData = m_CharacterData[aCharacter];
     if(characterData != nullptr)
     {
         return characterData->GetAdvanceX();
     }
     return 0;
 }
开发者ID:Epidilius,项目名称:PhysicsHackAndSlash,代码行数:9,代码来源:BitmapFont.cpp

示例9: switch

void JSCharacterData::putValueProperty(ExecState* exec, int token, JSValue* value)
{
    switch (token) {
    case DataAttrNum: {
        CharacterData* imp = static_cast<CharacterData*>(impl());
        ExceptionCode ec = 0;
        imp->setData(valueToStringWithNullCheck(exec, value), ec);
        setDOMException(exec, ec);
        break;
    }
    }
}
开发者ID:achellies,项目名称:ISeeBrowser,代码行数:12,代码来源:JSCharacterData.cpp

示例10: jsCharacterDataPrototypeFunctionAppendData

JSValue* jsCharacterDataPrototypeFunctionAppendData(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSCharacterData::s_info))
        return throwError(exec, TypeError);
    JSCharacterData* castedThisObj = static_cast<JSCharacterData*>(thisValue);
    CharacterData* imp = static_cast<CharacterData*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& data = args.at(exec, 0)->toString(exec);

    imp->appendData(data, ec);
    setDOMException(exec, ec);
    return jsUndefined();
}
开发者ID:achellies,项目名称:ISeeBrowser,代码行数:13,代码来源:JSCharacterData.cpp

示例11: runTest

    /*
     * Runs the test case.
     */
    void runTest()
    {
        Document doc;
        NodeList elementList;
        Node nameNode;
        CharacterData child;
        String childData;
        doc = (Document) baseT::load("staff", false);
        elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
        nameNode = elementList.item(0);
        child = (CharacterData) nameNode.getFirstChild();
        childData = child.getData();
        baseT::assertEquals("Margaret Martin", childData, __LINE__, __FILE__);

    }
开发者ID:kthguru,项目名称:arabica,代码行数:18,代码来源:characterdatagetdata.hpp

示例12: runTest

  /*
   * Runs the test case.
   */
  void runTest()
  {
     Document doc;
     NodeList elementList;
     Node nameNode;
     CharacterData child;
     String childData;
     doc = (Document) baseT::load("staff", true);
     elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
     nameNode = elementList.item(0);
     child = (CharacterData) nameNode.getFirstChild();
     child.replaceData(30, 5, SA::construct_from_utf8("98665"));
     childData = child.getData();
     baseT::assertEquals("1230 North Ave. Dallas, Texas 98665", childData, __LINE__, __FILE__);
 
  }
开发者ID:QuentinFiard,项目名称:arabica,代码行数:19,代码来源:characterdatareplacedataend.hpp

示例13: MaybeCreate

// static
already_AddRefed<DeleteTextTransaction>
DeleteTextTransaction::MaybeCreateForPreviousCharacter(
                         EditorBase& aEditorBase,
                         CharacterData& aCharData,
                         uint32_t aOffset)
{
  if (NS_WARN_IF(!aOffset)) {
    return nullptr;
  }

  nsAutoString data;
  aCharData.GetData(data);
  if (NS_WARN_IF(data.IsEmpty())) {
    return nullptr;
  }

  uint32_t length = 1;
  uint32_t offset = aOffset - 1;
  if (offset &&
      NS_IS_LOW_SURROGATE(data[offset]) &&
      NS_IS_HIGH_SURROGATE(data[offset - 1])) {
    ++length;
    --offset;
  }
  return DeleteTextTransaction::MaybeCreate(aEditorBase, aCharData,
                                            offset, length);
}
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:28,代码来源:DeleteTextTransaction.cpp

示例14: runTest

  /*
   * Runs the test case.
   */
  void runTest()
  {
     Document doc;
     NodeList elementList;
     Node nameNode;
     CharacterData child;
     String childData;
     doc = (Document) baseT::load("hc_staff", true);
     elementList = doc.getElementsByTagName(SA::construct_from_utf8("acronym"));
     nameNode = elementList.item(0);
     child = (CharacterData) nameNode.getFirstChild();
     child.deleteData(0, 16);
     childData = child.getData();
     baseT::assertEquals("Dallas, Texas 98551", childData, __LINE__, __FILE__);
 
  }
开发者ID:QuentinFiard,项目名称:arabica,代码行数:19,代码来源:hc_characterdatadeletedatabegining.hpp

示例15: runTest

  /*
   * Runs the test case.
   */
  void runTest()
  {
     Document doc;
     NodeList elementList;
     Node nameNode;
     CharacterData child;
     String childValue;
     int childLength;
     doc = (Document) baseT::load("staff", false);
     elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
     nameNode = elementList.item(0);
     child = (CharacterData) nameNode.getFirstChild();
     childValue = child.getData();
     childLength = SA::length(childValue);
     baseT::assertEquals(15, childLength, __LINE__, __FILE__);
 
  }
开发者ID:QuentinFiard,项目名称:arabica,代码行数:20,代码来源:characterdatagetlength.hpp


注:本文中的CharacterData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。