Browse Source

Clean up

doc
Hauke Zühl 9 years ago
parent
commit
cdf5271db0
  1. 5
      CMakeLists.txt
  2. 8
      include/Telegram/exec.h
  3. 9
      include/Telegram/explode.h
  4. 21
      src/exec.cc
  5. 28
      src/explode.cc

5
CMakeLists.txt

@ -5,12 +5,10 @@ set (HEADERS
include/Telegram/PhotoSize.h include/Telegram/PhotoSize.h
include/Telegram/User.h include/Telegram/User.h
include/Telegram/Chat.h include/Telegram/Chat.h
include/Telegram/exec.h
include/Telegram/Location.h include/Telegram/Location.h
include/Telegram/std.h include/Telegram/std.h
include/Telegram/Venue.h include/Telegram/Venue.h
include/Telegram/Contact.h include/Telegram/Contact.h
include/Telegram/explode.h
include/Telegram/MessageEntity.h include/Telegram/MessageEntity.h
include/Telegram/Sticker.h include/Telegram/Sticker.h
include/Telegram/Video.h include/Telegram/Video.h
@ -27,12 +25,10 @@ set (SOURCES
src/PhotoSize.cc src/PhotoSize.cc
src/User.cc src/User.cc
src/Chat.cc src/Chat.cc
src/exec.cc
src/Location.cc src/Location.cc
src/std.cc src/std.cc
src/Venue.cc src/Venue.cc
src/Contact.cc src/Contact.cc
src/explode.cc
src/MessageEntity.cc src/MessageEntity.cc
src/Sticker.cc src/Sticker.cc
src/Video.cc src/Video.cc
@ -66,4 +62,3 @@ target_link_libraries(tgbotpp ${LIBS})
install(TARGETS tgbotpp DESTINATION lib) install(TARGETS tgbotpp DESTINATION lib)
install(FILES ${HEADERS} DESTINATION include/Telegram) install(FILES ${HEADERS} DESTINATION include/Telegram)
install(FILES tgbotpp.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}") install(FILES tgbotpp.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")

8
include/Telegram/exec.h

@ -1,8 +0,0 @@
#ifndef __EXEC_H__
#define __EXEC_H__
#include <string>
std::string exec(const char*);
#endif

9
include/Telegram/explode.h

@ -1,9 +0,0 @@
#ifndef __explode_h__
#define __explode_h__
#include <string>
#include <vector>
std::vector<std::string> explode( const std::string&, const std::string &);
#endif

21
src/exec.cc

@ -1,21 +0,0 @@
#include "Telegram/exec.h"
#include <iostream>
#include <stdio.h>
std::string exec(const char* cmd) {
FILE* pipe = popen(cmd, "r");
if (!pipe)
return "ERROR";
char buffer[128];
std::string result = "";
while (!feof(pipe)) {
if (fgets(buffer, 128, pipe) != NULL)
result += buffer;
}
pclose(pipe);
return result;
}

28
src/explode.cc

@ -1,28 +0,0 @@
#include "Telegram/explode.h"
std::vector<std::string> explode( const std::string &delimiter, const std::string &str) {
std::vector<std::string> arr;
int strleng = str.length();
int delleng = delimiter.length();
if (delleng == 0)
return arr;//no change
int i = 0;
int k = 0;
while(i < strleng) {
int j = 0;
while ((i+j < strleng) && (j < delleng) && (str[i+j] == delimiter[j]))
j++;
if (j == delleng) {
arr.push_back(str.substr(k, i-k));
i += delleng;
k = i;
} else {
i++;
}
}
arr.push_back(str.substr(k, i-k));
return arr;
}
Loading…
Cancel
Save