Skip to content

Commit

Permalink
format code with CLion
Browse files Browse the repository at this point in the history
  • Loading branch information
levalup committed Jun 16, 2024
1 parent 6088837 commit 2d6d802
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ foreach (path ${FILES})

# check if target exists
list(FIND TARGETS "${PREFIX}-${dir}" TARGET_INDEX)
if(TARGET_INDEX GREATER -1)
if (TARGET_INDEX GREATER -1)
target_sources(${PREFIX}-${dir} PUBLIC ${DIR_SRC})
continue()
endif()
endif ()

# add executable
add_executable(${PREFIX}-${dir} ${DIR_SRC} ${HEADERS})
Expand All @@ -47,10 +47,10 @@ foreach (path ${FILES})

# check if target exists
list(FIND TARGETS "${PREFIX}-${file}" TARGET_INDEX)
if(TARGET_INDEX GREATER -1)
if (TARGET_INDEX GREATER -1)
target_sources(${PREFIX}-${file} PUBLIC ${path})
continue()
endif()
endif ()

# add executable
add_executable(${PREFIX}-${file} ${path} ${HEADERS})
Expand Down
2 changes: 1 addition & 1 deletion examples/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
int main() {
uv::fs::open("a.txt", O_CREAT | O_RDONLY, 0777).then([&](int fd) {
std::cout << "open fd = " << fd << std::endl;
(void)uv::fs::close(fd);
(void) uv::fs::close(fd);
// throw uvcxx::exception(UV_EAGAIN);
throw std::logic_error("throw logic after close");
}).except<uvcxx::errcode>([](const uvcxx::errcode &e) {
Expand Down
6 changes: 3 additions & 3 deletions examples/getaddrinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ int main() {
"baidu.com", nullptr, &hints
).then([](addrinfo *ai) {
char addr[INET6_ADDRSTRLEN];
for (addrinfo* info = ai; info != nullptr; info = info->ai_next) {
uv_ip4_name((struct sockaddr_in*)info->ai_addr, addr, sizeof(addr));
for (addrinfo *info = ai; info != nullptr; info = info->ai_next) {
uv_ip4_name((struct sockaddr_in *) info->ai_addr, addr, sizeof(addr));
std::cout << "Found address: " << addr << std::endl;
uv::getnameinfo(info->ai_addr, 0).then([](const char *hostname, const char *service) {
std::cout << "Name: " << hostname << " " << service << std::endl;
Expand All @@ -30,4 +30,4 @@ int main() {
});
uv::default_loop().run();
return 0;
}
}
4 changes: 2 additions & 2 deletions examples/promise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ int main() {
throw std::logic_error("i");
});
promise<> v;
v.then([]() {}).except([](const std::exception &e) {}).finally([](){});
v.then([]() {}).except([](const std::exception &e) {}).finally([]() {});

{
promise_emitter pm(a);
promise_cast<decltype(a), float> t(a, [](float a){
promise_cast<decltype(a), float> t(a, [](float a) {
return std::make_tuple(std::floor(a), std::ceil(a));
});
t.resolve(12.6);
Expand Down
2 changes: 1 addition & 1 deletion examples/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main() {
q.push(1, 0);
q.push(1, 2);
q.close();
for (auto [i, j] : q) {
for (auto [i, j]: q) {
std::cout << i << " " << j << std::endl;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <uvcxx.h>

int main() {
uv::timer_t().start(1000, 1000).call([](){
uv::timer_t().start(1000, 1000).call([]() {
std::cout << "Hello~~~" << std::endl;
throw uvcxx::close_handle();
});
return uv::default_loop().run();
}
}
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ foreach (path ${FILES})

# check if target exists
list(FIND TARGETS "${PREFIX}-${dir}" TARGET_INDEX)
if(TARGET_INDEX GREATER -1)
if (TARGET_INDEX GREATER -1)
target_sources(${PREFIX}-${dir} PUBLIC ${DIR_SRC})
continue()
endif()
endif ()

# add executable
add_executable(${PREFIX}-${dir} ${DIR_SRC} ${HEADERS})
Expand All @@ -47,10 +47,10 @@ foreach (path ${FILES})

# check if target exists
list(FIND TARGETS "${PREFIX}-${file}" TARGET_INDEX)
if(TARGET_INDEX GREATER -1)
if (TARGET_INDEX GREATER -1)
target_sources(${PREFIX}-${file} PUBLIC ${path})
continue()
endif()
endif ()

# add executable
add_executable(${PREFIX}-${file} ${path} ${HEADERS})
Expand Down

0 comments on commit 2d6d802

Please sign in to comment.