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


C++ CVariant::isNull方法代码示例

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


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

示例1:

TEST(TestVariant, VariantTypeNull)
{
  CVariant a;

  EXPECT_TRUE(a.isNull());
  EXPECT_EQ(CVariant::VariantTypeNull, a.type());
}
开发者ID:2BReality,项目名称:xbmc,代码行数:7,代码来源:TestVariant.cpp

示例2: Announce

void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
  // Extract db id of item
  CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
  CStdString type;
  int id = 0;

  if (item->HasVideoInfoTag())
  {
    CVideoDatabase::VideoContentTypeToString(item->GetVideoContentType(), type);
    id = item->GetVideoInfoTag()->m_iDbId;
  }
  else if (item->HasMusicInfoTag())
  {
    type = "music";
    id = item->GetMusicInfoTag()->GetDatabaseId();
  }

  if (id > 0)
  {
    type += "id";
    object[type] = id;
  }

  Announce(flag, sender, message, object);
}
开发者ID:SHPURDYdBurt,项目名称:https-github.com-xbmc-atv2,代码行数:26,代码来源:AnnouncementManager.cpp

示例3: Supports

bool CInputStream::Supports(const CFileItem &fileitem)
{
  // check if a specific inputstream addon is requested
  CVariant addon = fileitem.GetProperty("inputstreamaddon");
  if (!addon.isNull())
  {
    if (addon.asString() != ID())
      return false;
    else
      return true;
  }

  // check paths
  CSingleLock lock(m_parentSection);

  bool match = false;
  for (auto &path : m_pathList)
  {
    if (path.empty())
      continue;

    CRegExp r(true, CRegExp::asciiOnly, path.c_str());
    if (r.RegFind(fileitem.GetPath().c_str()) == 0 && r.GetFindLen() > 5)
    {
      match = true;
      break;
    }
  }
  return match;
}
开发者ID:Hendrik7,项目名称:xbmc,代码行数:30,代码来源:InputStream.cpp

示例4: Announce

void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
  // Extract db id of item
  CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
  CStdString type;
  int id = 0;

  if (item->HasVideoInfoTag())
  {
    CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);

    id = item->GetVideoInfoTag()->m_iDbId;
  }
  else if (item->HasMusicInfoTag())
  {
    if (item->IsAlbum())
      type = "album";
    else
      type = "song";

    id = item->GetMusicInfoTag()->GetDatabaseId();
  }
  else
    type = "unknown";

  object["type"] = type;
  if (id > 0)
    object["id"] = id;

  Announce(flag, sender, message, object);
}
开发者ID:AWilco,项目名称:xbmc,代码行数:31,代码来源:AnnouncementManager.cpp

示例5: Announce

void CTCPServer::Announce(EAnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
    Value root;
    root["jsonrpc"] = "2.0";
    root["method"]  = "Announcement";
    root["params"]["sender"] = sender;
    root["params"]["message"] = message;
    if (!data.isNull())
        data.toJsonValue(root["params"]["data"]);

    StyledWriter writer;
    std::string str = writer.write(root);

    for (unsigned int i = 0; i < m_connections.size(); i++)
    {
        {
            CSingleLock lock (m_connections[i].m_critSection);
            if ((m_connections[i].GetAnnouncementFlags() & flag) == 0)
                continue;
        }

        unsigned int sent = 0;
        do
        {
            CSingleLock lock (m_connections[i].m_critSection);
            sent += send(m_connections[i].m_socket, str.c_str(), str.size() - sent, sent);
        } while (sent < str.size());
    }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例6: memset

TEST(TestJSONVariantParser, Parse)
{
  CVariant variant;
  unsigned char buf[100];

  memset(buf, 0, sizeof(buf));
  variant = CJSONVariantParser::Parse(buf, sizeof(buf));
  EXPECT_TRUE(variant.isNull());
}
开发者ID:A600,项目名称:xbmc,代码行数:9,代码来源:TestJSONVariantParser.cpp

示例7: AnnouncePropertyChanged

void CGUIWindowSlideShow::AnnouncePropertyChanged(const std::string &strProperty, const CVariant &value)
{
  if (strProperty.empty() || value.isNull())
    return;

  CVariant data;
  data["player"]["playerid"] = PLAYLIST_PICTURE;
  data["property"][strProperty] = value;
  ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: Save

bool CDatabaseQueryRule::Save(CVariant &obj) const
{
  if (obj.isNull() || (m_parameter.empty() && m_operator != OPERATOR_TRUE && m_operator != OPERATOR_FALSE))
    return false;

  obj["field"] = TranslateField(m_field);
  obj["operator"] = TranslateOperator(m_operator);
  obj["value"] = m_parameter;

  return true;
}
开发者ID:B0k0,项目名称:xbmc,代码行数:11,代码来源:DatabaseQuery.cpp

示例9: FilterVar

static bool FilterVar(bool valid, const CVariant& variant,
                                  const std::string& check)
{
  if (!valid)
    return false;

  if (variant.isNull() || variant.asString().empty())
    return false;

  std::string regions = variant.asString();
  return regions.find(check) == std::string::npos;
}
开发者ID:cpaowner,项目名称:xbmc,代码行数:12,代码来源:GUIWindowAddonBrowser.cpp

示例10: AnnouncePropertyChanged

void CPlayListPlayer::AnnouncePropertyChanged(int iPlaylist, const std::string &strProperty, const CVariant &value)
{
  if (strProperty.empty() || value.isNull() ||
     (iPlaylist == PLAYLIST_VIDEO && !g_application.m_pPlayer->IsPlayingVideo()) ||
     (iPlaylist == PLAYLIST_MUSIC && !g_application.m_pPlayer->IsPlayingAudio()))
    return;

  CVariant data;
  data["player"]["playerid"] = iPlaylist;
  data["property"][strProperty] = value;
  ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
}
开发者ID:Razzeee,项目名称:xbmc,代码行数:12,代码来源:PlayListPlayer.cpp

示例11: Supports

bool CInputStream::Supports(const CFileItem &fileitem)
{
    {
        CSingleLock lock(m_parentSection);

        auto it = m_configMap.find(ID());
        if (it == m_configMap.end())
            return false;
        if (!it->second.m_ready)
            return false;
    }

    // check if a specific inputstream addon is requested
    CVariant addon = fileitem.GetProperty("inputstreamaddon");
    if (!addon.isNull())
    {
        if (addon.asString() != ID())
            return false;
        else
            return true;
    }

    // check protocols
    std::string protocol = fileitem.GetURL().GetProtocol();
    if (!protocol.empty())
    {
        if (std::find(m_protocolsList.begin(),
                      m_protocolsList.end(), protocol) != m_protocolsList.end())
            return true;
    }

    // check paths
    CSingleLock lock(m_parentSection);
    auto it = m_configMap.find(ID());
    if (it == m_configMap.end())
        return false;

    bool match = false;
    for (auto &path : it->second.m_pathList)
    {
        if (path.empty())
            continue;

        CRegExp r(true, CRegExp::asciiOnly, path.c_str());
        if (r.RegFind(fileitem.GetPath().c_str()) == 0 && r.GetFindLen() > 5)
        {
            match = true;
            break;
        }
    }
    return match;
}
开发者ID:mhueske,项目名称:xbmc,代码行数:52,代码来源:InputStream.cpp

示例12: Save

bool CDatabaseQueryRule::Save(CVariant &obj) const
{
  if (obj.isNull() || (m_parameter.empty() && m_operator != OPERATOR_TRUE && m_operator != OPERATOR_FALSE))
    return false;

  obj["field"] = TranslateField(m_field);
  obj["operator"] = TranslateOperator(m_operator);

  obj["value"] = CVariant(CVariant::VariantTypeArray);
  for (vector<CStdString>::const_iterator it = m_parameter.begin(); it != m_parameter.end(); it++)
    obj["value"].push_back(*it);

  return true;
}
开发者ID:Anankin,项目名称:xbmc,代码行数:14,代码来源:DatabaseQuery.cpp

示例13: Save

bool CSmartPlaylistRule::Save(CVariant &obj) const
{
  if (obj.isNull() || m_parameter.empty())
    return false;

  CVariant rule(CVariant::VariantTypeObject);
  rule["field"] = TranslateField(m_field);
  rule["operator"] = TranslateOperator(m_operator);

  rule["value"] = CVariant(CVariant::VariantTypeArray);
  for (vector<CStdString>::const_iterator it = m_parameter.begin(); it != m_parameter.end(); it++)
    rule["value"].push_back(*it);

  obj.push_back(rule);
  return true;
}
开发者ID:mmankarious,项目名称:xbmc,代码行数:16,代码来源:SmartPlayList.cpp

示例14: GetAll

CVariant CDBusUtil::GetAll(const char *destination, const char *object, const char *interface)
{
  CDBusMessage message(destination, object, "org.freedesktop.DBus.Properties", "GetAll");
  CVariant properties;
  message.AppendArgument(interface);
  DBusMessage *reply = message.SendSystem();
  if (reply)
  {
    DBusMessageIter iter;
    if (dbus_message_iter_init(reply, &iter))
    {
      if (!dbus_message_has_signature(reply, "a{sv}"))
        CLog::Log(LOGERROR, "DBus: wrong signature on GetAll - should be \"a{sv}\" but was %s", dbus_message_iter_get_signature(&iter));
      else
      {
        do
        {
          DBusMessageIter sub;
          dbus_message_iter_recurse(&iter, &sub);
          do
          {
            DBusMessageIter dict;
            dbus_message_iter_recurse(&sub, &dict);
            do
            {
              const char * key = NULL;

              dbus_message_iter_get_basic(&dict, &key);
              if (!dbus_message_iter_next(&dict))
                break;

              CVariant value = ParseVariant(&dict);

              if (!value.isNull())
                properties[key] = value;

            } while (dbus_message_iter_next(&dict));

          } while (dbus_message_iter_next(&sub));

        } while (dbus_message_iter_next(&iter));
      }
    }
  }

  return properties;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:47,代码来源:DBusUtil.cpp

示例15: BuildResponse

inline void CJSONRPC::BuildResponse(const CVariant& request, JSON_STATUS code, const CVariant& result, CVariant& response)
{
  response["jsonrpc"] = "2.0";
  response["id"] = request.isObject() && request.isMember("id") ? request["id"] : CVariant();

  switch (code)
  {
    case OK:
      response["result"] = result;
      break;
    case ACK:
      response["result"] = "OK";
      break;
    case InvalidRequest:
      response["error"]["code"] = InvalidRequest;
      response["error"]["message"] = "Invalid request.";
      break;
    case InvalidParams:
      response["error"]["code"] = InvalidParams;
      response["error"]["message"] = "Invalid params.";
      if (!result.isNull())
        response["error"]["data"] = result;
      break;
    case MethodNotFound:
      response["error"]["code"] = MethodNotFound;
      response["error"]["message"] = "Method not found.";
      break;
    case ParseError:
      response["error"]["code"] = ParseError;
      response["error"]["message"] = "Parse error.";
      break;
    case BadPermission:
      response["error"]["code"] = BadPermission;
      response["error"]["message"] = "Bad client permission.";
      break;
    case FailedToExecute:
      response["error"]["code"] = FailedToExecute;
      response["error"]["message"] = "Failed to execute method.";
      break;
    default:
      response["error"]["code"] = InternalError;
      response["error"]["message"] = "Internal error.";
      break;
  }
}
开发者ID:Sky-git,项目名称:xbmc,代码行数:45,代码来源:JSONRPC.cpp


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