urlmanager.cpp 678 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "urlmanager.h"
  2. const wchar_t *URLManager::GetURL(const wchar_t *urlid)
  3. {
  4. for (URLList::iterator itr=urls.begin();itr!=urls.end();itr++)
  5. {
  6. if (!_wcsicmp(urlid, itr->urlid))
  7. {
  8. return itr->url;
  9. }
  10. }
  11. return 0;
  12. }
  13. void URLManager::AddURL(const wchar_t *urlid, const wchar_t *url)
  14. {
  15. for (URLList::iterator itr=urls.begin();itr!=urls.end();itr++)
  16. {
  17. if (!_wcsicmp(urlid, itr->urlid))
  18. {
  19. free(itr->url);
  20. itr->url=_wcsdup(url);
  21. return ;
  22. }
  23. }
  24. URLS newUrl;
  25. newUrl.urlid = _wcsdup(urlid);
  26. newUrl.url = _wcsdup(url);
  27. urls.push_back(newUrl);
  28. }
  29. #define CBCLASS URLManager
  30. START_DISPATCH;
  31. CB(API_URLMANAGER_GETURL, GetURL);
  32. END_DISPATCH;
  33. #undef CBCLASS