doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
3278ab5f-6fd4-4aeb-9112-a37a92ef58d7
{ "language": "C++" }
```c++ #include <cucumber-cpp/internal/connectors/wire/WireServer.hpp> namespace cucumber { namespace internal { SocketServer::SocketServer(const ProtocolHandler *protocolHandler) : ios(), acceptor(ios), protocolHandler(protocolHandler) { } void SocketServer::listen(const port_type port) { tcp::endpo...
```c++ #include <cucumber-cpp/internal/connectors/wire/WireServer.hpp> namespace cucumber { namespace internal { SocketServer::SocketServer(const ProtocolHandler *protocolHandler) : protocolHandler(protocolHandler), ios(), acceptor(ios) { } void SocketServer::listen(const port_type port) { tcp::endpo...
4e4d83f1-4fd8-420d-9d8c-4c3d2e8362fd
{ "language": "C++" }
```c++ /** ** \file libport/perror.cc ** \brief perror: implements file libport/perror.hh */ #include <cstdio> #include <iostream> #include "libport/cstring" namespace libport { void perror (const char* s) { #ifndef WIN32 ::perror(s); #else int errnum; const char* errstring; const char* col...
```c++ /** ** \file libport/perror.cc ** \brief perror: implements file libport/perror.hh */ #include <cstdio> #include <iostream> #include "libport/windows.hh" #include "libport/cstring" namespace libport { void perror (const char* s) { #ifndef WIN32 ::perror(s); #else int errnum; const char* ...
900ca0de-a662-4506-b71d-7f1e3d00a453
{ "language": "C++" }
```c++ #include <QThread> int main() { QThread::sleep(60); } ``` Fix "inifiniteLoop" test for Qt 4.
```c++ #include <QThread> class MyThread : public QThread { public: static void mySleep(unsigned long secs) { sleep(secs); } // sleep() is protected in Qt 4. }; int main() { MyThread::mySleep(60); } ```
03a804be-d939-47ab-8341-aa13d6540a29
{ "language": "C++" }
```c++ #include <miniMAT/util/PrintResult.hpp> #include <iostream> #include <iomanip> namespace miniMAT { namespace util { void PrintResult(std::string varname, Matrix m, bool suppressed) { if (!suppressed) { // Print a row at a time (default precision is 4) std::cout << varname ...
```c++ #include <miniMAT/util/PrintResult.hpp> #include <iostream> #include <iomanip> #include <cmath> namespace miniMAT { namespace util { void PrintResult(std::string varname, Matrix m, bool suppressed) { if (!suppressed) { using namespace std; int maxdigits = log10(m.maxCoeff...
50758aaa-7db7-49ce-b4a4-71be797011c0
{ "language": "C++" }
```c++ /** * @file Connection.cpp * @brief * @author Travis Lane * @version 0.0.1 * @date 2016-01-05 */ #include "Connection.h" Connection::Connection(Bluetooth &new_bt, int id) : bt(new_bt) { this->id = id; } int Connection::write(int percent) { int rc = 0; StaticJsonBuffer<200> buffer; JsonObject& ob...
```c++ /** * @file Connection.cpp * @brief * @author Travis Lane * @version 0.0.1 * @date 2016-01-05 */ #include "Connection.h" Connection::Connection(Bluetooth &new_bt, int id) : bt(new_bt) { this->id = id; } int Connection::write(int percent) { int rc = 0; StaticJsonBuffer<200> buffer; JsonObject& ob...
2c9b99d9-78a3-42ee-9f6a-300bd49f0e74
{ "language": "C++" }
```c++ /* * This file is part of Peli - universal JSON interaction library * Copyright (C) 2014 Alexey Chernov <4ernov@gmail.com> * * Peli is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either ...
```c++ /* * This file is part of Peli - universal JSON interaction library * Copyright (C) 2014 Alexey Chernov <4ernov@gmail.com> * * Peli is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either ...
53aa940a-4cac-4e52-a9f0-1fdf3e85d070
{ "language": "C++" }
```c++ #include "browser/inspectable_web_contents.h" #include "browser/inspectable_web_contents_impl.h" namespace brightray { InspectableWebContents* InspectableWebContents::Create(const content::WebContents::CreateParams& create_params) { return Create(content::WebContents::Create(create_params)); } InspectableW...
```c++ #include "browser/inspectable_web_contents.h" #include "browser/inspectable_web_contents_impl.h" #include "content/public/browser/web_contents_view.h" namespace brightray { InspectableWebContents* InspectableWebContents::Create(const content::WebContents::CreateParams& create_params) { auto contents = cont...
1a3b8aa6-9cb5-42da-ad8f-fe4cebffb894
{ "language": "C++" }
```c++ /* * Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
```c++ /* * Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
6a43b7de-7d76-436a-88b8-ac00521a3644
{ "language": "C++" }
```c++ #include "Benchmark.h" #include "SkPMFloat.h" #include "SkRandom.h" struct PMFloatBench : public Benchmark { explicit PMFloatBench(bool clamp) : fClamp(clamp) {} const char* onGetName() SK_OVERRIDE { return fClamp ? "SkPMFloat_clamp" : "SkPMFloat_get"; } bool isSuitableFor(Backend backend) SK_OVERR...
```c++ #include "Benchmark.h" #include "SkPMFloat.h" // Used to prevent the compiler from optimizing away the whole loop. volatile uint32_t blackhole = 0; // Not a great random number generator, but it's very fast. // The code we're measuring is quite fast, so low overhead is essential. static uint32_t lcg_rand(uint3...
5a5e6f8b-0f8f-4f86-93a3-e6711c55ff80
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s // PR7800 class NoDestroy { ~NoDestroy(); }; // expected-note {{declared private here}} struct A { virtual ~A(); }; struct B : public virtual A { NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}} }; struct D : public virtual B { ...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s // PR7800 class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}} struct A { virtual ~A(); }; struct B : public virtual A { NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}} }; struct D : public virtual B ...
5f847d95-f867-4b28-85b9-8906b6be97a5
{ "language": "C++" }
```c++ /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "RootShadowNode.h" #include <react/components/view/conversions.h> namespace facebook { namespace react { const ...
```c++ /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "RootShadowNode.h" #include <react/components/view/conversions.h> #include <react/debug/SystraceSection.h> names...
2f89e7cb-07ee-4ca5-9685-e2d2f72541cd
{ "language": "C++" }
```c++ // // Copyright (c) 2017 The nanoFramework project contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // #include "CorLib.h" HRESULT Library_corlib_native_System_Diagnostics_Debugger::get_IsAttached___STATIC_...
```c++ // // Copyright (c) 2017 The nanoFramework project contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // #include "CorLib.h" HRESULT Library_corlib_native_System_Diagnostics_Debugger::get_IsAttached___STATIC_...
61516748-0d25-4600-bc12-5430f51dfada
{ "language": "C++" }
```c++ #include <polar/core/log.h> #include <polar/fs/local.h> #include <polar/util/sdl.h> namespace polar::core { std::shared_ptr<logger> logger::instance; void logger::msgbox(std::string title, std::string msg) { #if defined(_WIN32) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.data(), msg.data(), NULL);...
```c++ #include <polar/core/log.h> #include <polar/fs/local.h> #include <polar/util/sdl.h> namespace polar::core { std::shared_ptr<logger> logger::instance; void logger::msgbox(std::string title, std::string msg) { #if defined(_WIN32) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.data(), msg.data(), NULL);...
717e2ba1-9af1-43bc-8e5b-aafa52dc3f5c
{ "language": "C++" }
```c++ // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "bin/directory.h" bool Directory::Open(const char* path, intptr_t* dir) { UNIMPLEMEN...
```c++ // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "bin/directory.h" bool Directory::Open(const char* path, intptr_t* dir) { UNIMPLEMEN...
e832d7bf-ef2f-4d02-8dbc-c478086b4104
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "tcframe_test_commons.cpp" #include "tcframe/problem.hpp" using tcframe::BaseProblem; class MyProblem : public BaseProblem { protected: void Config() { setSlug("foo"); setTimeLimit(2); setMemoryLimit(256); } void InputFormat() { } voi...
```c++ #include "gtest/gtest.h" #include "tcframe_test_commons.cpp" #include "tcframe/problem.hpp" using tcframe::BaseProblem; class MyProblem : public BaseProblem { protected: void Config() { setSlug("foo"); setTimeLimit(2); setMemoryLimit(256); } void InputFormat() { } voi...
360b6b41-55fe-4d64-b78e-316bb2a4530b
{ "language": "C++" }
```c++ #include <iostream> int main() { std::cout << "Fractalogy!\n"; return 0; } ``` Add the iteration function for the fractals
```c++ #include <iostream> #include <complex> using std::cout; using std::complex; using std::exp; using std::norm; /// returns -1 on failing to escape int iteration(complex<double> c, int limit = 1000) { int i = 0; double n; complex<double> z(0, 0); while ((n = norm(z)) < 4 && i < limit) { z = exp(z) - c...
1cb2d09d-f166-4f38-93f2-98284597cbb3
{ "language": "C++" }
```c++ #include "ImageWriter.h" uint32 ImageWriter::GetChannelForPixel(uint32 x, uint32 y, uint32 ch) { uint32 bytesPerRow = GetWidth() * 4; uint32 byteLocation = y * bytesPerRow + x*4 + ch; return m_PixelData[byteLocation]; } ``` Make sure that we assume pixels are in block stream order when accessing.
```c++ #include "ImageWriter.h" uint32 ImageWriter::GetChannelForPixel(uint32 x, uint32 y, uint32 ch) { // Assume pixels are in block stream order, hence we would need to first find // the block that contains pixel (x, y) and then find the byte location for it. const uint32 blocksPerRow = GetWidth() / 4; con...
bb622b5c-349a-4cbb-843d-39ff21fc1c39
{ "language": "C++" }
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Games/Game.hpp> #include <Rosetta/Mod...
```c++ // This code is based on Sabberstone project. // Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva // RosettaStone is hearthstone simulator using C++ with reinforcement learning. // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon #include <Rosetta/Games/Game.hpp> #include <Rosetta/Gam...
d4df0902-bf8e-48d2-8177-671df116200e
{ "language": "C++" }
```c++ /* * This file is part of ATLAS. It is subject to the license terms in * the LICENSE file found in the top-level directory of this distribution. * (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt) * You may not use this file except in compliance with the License. */ #include <iostream> #include ...
```c++ /* * This file is part of ATLAS. It is subject to the license terms in * the LICENSE file found in the top-level directory of this distribution. * (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt) * You may not use this file except in compliance with the License. */ #include <iostream> #include ...
1b61b8f8-615a-43e5-8f11-277e49d14b20
{ "language": "C++" }
```c++ /* * CardDeck.cpp * * Created on: 2014年10月25日 * Author: nemo */ #include "CardDeck.h" #include <iostream> CardDeck::CardDeck() { LOG_TRACE("Construct CardDeck.") } CardDeck::~CardDeck() { // TODO Auto-generated destructor stub } /// Insert card into card deck. /** * @brief Insert card into ca...
```c++ /* * CardDeck.cpp * * Created on: 2014年10月25日 * Author: nemo */ #include "CardDeck.h" #include <iostream> CardDeck::CardDeck() { LOG_TRACE("Construct CardDeck.") } CardDeck::~CardDeck() { // TODO Auto-generated destructor stub } /// Insert card into card deck. /** * @brief Insert card into ca...
42eb4b9c-0b4d-427b-bba4-848d5ddcff07
{ "language": "C++" }
```c++ /* This file is part of VoltDB. * Copyright (C) 2008-2012 VoltDB Inc. * * VoltDB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later ve...
```c++ /* This file is part of VoltDB. * Copyright (C) 2008-2012 VoltDB Inc. * * VoltDB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later ve...
afee1c53-a213-43a4-be98-fd9e4f2dc2dd
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "courgette/crc.h" #ifdef OS_CHROMEOS # include "zlib.h" #else extern "C" { # include "third_party/lzma_sdk/7zCrc.h" } #endif #incl...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Calculate Crc by calling CRC method in LZMA SDK #include "courgette/crc.h" extern "C" { #include "third_party/lzma_sdk/7zCrc.h" } namespa...
4d9e64c1-565f-4cee-848c-892aea1b3a46
{ "language": "C++" }
```c++ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <ncurses.h> #include <csignal> #include <cstdlib> #include "signals.hh" extern "C" { static void...
```c++ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <ncurses.h> #include <signal.h> #include <stdlib.h> #include "signals.hh" extern "C" { static vo...
593293a6-c5cd-4ed7-8497-d050fec6c781
{ "language": "C++" }
```c++ #include "commands.h" #include "sim/except.h" #include <iostream> using namespace std; void PrintException(Simulator::MGSystem *sys, ostream& out, const exception& e) { out << endl << e.what() << endl; auto se = dynamic_cast<const Simulator::SimulationException*>(&e); if (se != NULL) { ...
```c++ #include "commands.h" #include "sim/except.h" #include <iostream> using namespace std; void PrintException(Simulator::MGSystem *sys, ostream& out, const exception& e) { out << endl << e.what() << endl; auto se = dynamic_cast<const Simulator::SimulationException*>(&e); if (se != NULL) { ...
30a02263-b916-492a-b206-af0eaa68a966
{ "language": "C++" }
```c++ /*############################################################################################ Garden System Wireless controller for watering electropumps Author: Daniele Colanardi License: BSD, see LICENSE file ############################################################################################*/ ...
```c++ /*############################################################################################ Garden System Wireless controller for watering electropumps Author: Daniele Colanardi License: BSD, see LICENSE file ############################################################################################*/ ...
524f86c8-9db7-4942-8e10-930cd6a43a3b
{ "language": "C++" }
```c++ // // Created by Sam on 11/18/2017. // #include "../../../build/catch-src/include/catch.hpp" #include "../../../include/Game/Python/Factory.h" TEST_CASE("Create factory") { auto* factory = new Factory(); delete factory; // // SECTION("Verify creation") // { // REQUIRE_FALSE(factory == null...
```c++ // // Created by Sam on 11/18/2017. // #include "../../../build/catch-src/include/catch.hpp" #include "../../../include/Game/Python/Factory.h" TEST_CASE("Create factory") { std::shared_ptr<Factory> factory = std::make_shared<Factory>(); SECTION("Verify creation") { REQUIRE_FALSE(factory ==...
e6bdf65a-8ce8-4a20-ac1c-2af6ba692b4f
{ "language": "C++" }
```c++ #include "zonotope_halfspaces.hpp" #include <gmpxx.h> #include <iostream> int main() { using namespace std; typedef mpz_class NT; int n_tests; cin >> n_tests; for ( int t = 0; t < n_tests; ++t ) { int n, d; cin >> n >> d; vector<vector<NT> > generators ( n, vector<NT> ( d ) ); for...
```c++ #include "zonotope_halfspaces.hpp" #include <gmpxx.h> #include <iostream> int main() { using namespace std; int n_tests; cin >> n_tests; for ( int t = 0; t < n_tests; ++t ) { int n, d; cin >> n >> d; vector<vector<mpz_class> > generators_mpz ( n, vector<mpz_class> ( d ) ); ve...
a7dcf24f-3178-466e-a77f-a561038c9f53
{ "language": "C++" }
```c++ #include <iostream> #include <talk/base/cryptstring.h> #include <talk/base/logging.h> #include <talk/xmpp/xmppclientsettings.h> #include "xmppthread.h" int main(int argc, char* argv[]) { talk_base::LogMessage::LogToDebug(talk_base::LS_SENSITIVE); talk_base::InsecureCryptStringImpl ipass; ipass.password(...
```c++ #include <iostream> #include <talk/base/cryptstring.h> #include <talk/base/logging.h> #include <talk/xmpp/xmppclientsettings.h> #include "xmppthread.h" int main(int argc, char* argv[]) { talk_base::LogMessage::LogToDebug(talk_base::LS_SENSITIVE); talk_base::InsecureCryptStringImpl ipass; ipass.password(...
624d4e71-ab66-4c93-aab6-6d5f7df8a51f
{ "language": "C++" }
```c++ extern "C" void kmain(void* /*mbd*/, u32 magic) { if ( magic != 0x2BADB002 ) { /* Something went not according to specs. Print an error */ /* message and halt, but do *not* rely on the multiboot */ /* data structure. */ } /* You could either use multiboot.h */ /* (http://www.gnu...
```c++ const int console_width = 80; const int console_height = 25; const u8 color = 0x07; /* light grey (7) on black (0). */ u16 volatile* videoram = (u16 volatile*) 0xb8000; void clear_screen() { for(int i = 0; i < console_height * console_width; i++) videoram[i] = (color << 8) | ' '; } void put_char_at(c...
7a345ae3-bc26-4991-9a09-cbb15387afed
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Jav...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" // Disabled, http://crbug.com/63589. IN_PROC...
16846115-6b08-4eb8-a6ca-1bec476ef178
{ "language": "C++" }
```c++ // ============================================================================= // Authors: Radu Serban, Justin Madsen // ============================================================================= // // Base class for a vehicle wheel. // A wheel subsystem does not own a body. Instead, when attached to a susp...
```c++ // ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All right reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top leve...
613d893b-c489-403a-815d-2ad6d9f2c359
{ "language": "C++" }
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Jav...
```c++ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" #include "net/base/mock_host_resolver.h" // Disabled, http://crbug.com/63589. IN_PROC...
941f385f-1d4b-4ba6-8981-00841ba593d7
{ "language": "C++" }
```c++ #include "Table.h" // int insertInstruction(int state, int symbol, int newState, int newSymbol, // char instruction); // void removeInstruction(int id); // machineAction_t getAction(int state, int symbol); // TODO: implement Table methods int Table::insertInstruction(int ...
```c++ #include "Table.h" // int insertInstruction(int state, int symbol, int newState, int newSymbol, // char instruction); // void removeInstruction(int id); // machineAction_t getAction(int state, int symbol); // TODO: implement Table methods int Table::insertInstruction(int ...
e969912c-9f02-4b7a-9604-3503a49729d3
{ "language": "C++" }
```c++ #include <avr/pgmspace.h> #include <stdlib.h> char *to_print; char *pgmStrToRAM(PROGMEM char *theString) { free(to_print); to_print=(char *) malloc(strlen_P(theString) + 1); strcpy_P(to_print, theString); return (to_print); }``` Add include to support SAMD core
```c++ #include <avr/pgmspace.h> #include <stdlib.h> #include <string.h> char *to_print; char *pgmStrToRAM(PROGMEM char *theString) { free(to_print); to_print=(char *) malloc(strlen_P(theString) + 1); strcpy_P(to_print, theString); return (to_print); }```
8321ca21-a98c-47f0-8223-e3f45594acaa
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/icon_loader.h" #include "base/message_loop.h" #include "base/mime_util.h" #include "base/thread.h" #include "chrome/b...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/icon_loader.h" #include "base/message_loop.h" #include "base/mime_util.h" #include "base/thread.h" #include "chrome/b...
263385a9-5a48-4ebd-bf74-4f97cde28b67
{ "language": "C++" }
```c++ /* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 256; #define LOG_TAG "skia" #include <android/log.h> void SkDebugf(const char format[], ...
```c++ /* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkTypes.h" static const size_t kBufferSize = 256; #define LOG_TAG "skia" #include <android/log.h> static bool gSkDebugToStdOut = fals...
592d05b1-86a5-4814-b596-a129b8f1c375
{ "language": "C++" }
```c++ #include <3ds.h> #include <stdio.h> void shutdown3DS() { Handle ptmSysmHandle = 0; Result result = srvGetServiceHandle(&ptmSysmHandle, "ns:s"); if (result != 0) return; // http://3dbrew.org/wiki/NSS:ShutdownAsync u32 *commandBuffer = getThreadCommandBuffer(); commandBuffer[0] = 0x000E0000...
```c++ #include <3ds.h> #include <stdio.h> void shutdown3DS() { Handle nssHandle = 0; Result result = srvGetServiceHandle(&nssHandle, "ns:s"); if (result != 0) return; // http://3dbrew.org/wiki/NSS:ShutdownAsync u32 *commandBuffer = getThreadCommandBuffer(); commandBuffer[0] = 0x000E0000; sv...
efcc9419-6434-4083-8eac-9ded733b0107
{ "language": "C++" }
```c++ // Copyright 2015 FMAW #include <iostream> #include <fstream> #include "./grid.h" #include "./gridmap.h" #include <fat.h> #include <nds.h> namespace GridMap{ void loadDefaultGridMap( Grid &g ) { loadGridMap("defaultMap", g); } void loadGridMap( const char* mapName, Grid &g ){ FILE* test = fopen ("./defaultM...
```c++ // Copyright 2015 FMAW #include <fat.h> #include <nds.h> #include <iostream> #include <fstream> #include "./grid.h" #include "./gridmap.h" namespace GridMap { void loadDefaultGridMap(Grid &g) { loadGridMap("defaultMap", g); } void loadGridMap(const char *mapName, Grid &g) { FILE *test = fopen("./defa...
e2e06db1-d14f-4918-80e9-78ac81a1943b
{ "language": "C++" }
```c++ #include <glow/memory.h> #include <glow/global.h> #include <glow/Extension.h> namespace { GLint getMemoryInformation(GLenum pname) { if (!glow::hasExtension("NVX_gpu_memory_info")) return -1; return glow::getInteger(pname); } } namespace glow { namespace memory { GLint total() { retur...
```c++ #include <glow/memory.h> #include <glow/global.h> #include <glow/Extension.h> namespace { GLint getMemoryInformation(GLenum pname) { if (!glow::hasExtension("NVX_gpu_memory_info")) return -1; return glow::getInteger(pname); } } namespace glow { namespace memory { GLint total() { retur...
7fddc5a6-5153-4e9d-89c3-28f4546be7b8
{ "language": "C++" }
```c++ /* * This is an open source non-commercial project. Dear PVS-Studio, please check it. * PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com */ #include "mips_memory.h" #include "mips_instr.h" #include <infra/instrcache/instr_cache.h> #include <iostream> FuncInstr MIPSMemory::fetch_instr( ...
```c++ /* * This is an open source non-commercial project. Dear PVS-Studio, please check it. * PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com */ #include "mips_memory.h" #include "mips_instr.h" #include <infra/instrcache/instr_cache.h> FuncInstr MIPSMemory::fetch_instr( Addr PC) { auto ...
9d634b1f-f8ed-4874-a4c0-49340260be46
{ "language": "C++" }
```c++ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===------------------...
```c++ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===------------------...
9f5cc8b1-71b7-439b-ac11-dea236fae318
{ "language": "C++" }
```c++ // For conditions of distribution and use, see copyright notice in license.txt /** * @file InventoryAsset.cpp * @brief A class representing asset in inventory. */ #include " #include "StableHeaders.h" #include "InventoryAsset.h" #include "InventoryFolder.h" namespace Inventory { Inventory...
```c++ // For conditions of distribution and use, see copyright notice in license.txt /** * @file InventoryAsset.cpp * @brief A class representing asset in inventory. */ #include "StableHeaders.h" #include "InventoryAsset.h" #include "InventoryFolder.h" namespace Inventory { InventoryAsset::Inven...
57b81143-ef8a-4232-a207-114200690c65
{ "language": "C++" }
```c++ #include <ros/ros.h> #include <tf2_ros/transform_broadcaster.h> #include <geometry_msgs/PointStamped.h> #include <geometry_msgs/TransformStamped.h> class TomatoBroadcaster { tf2_ros::TransformBroadcaster broadcaster_; geometry_msgs::TransformStamped transform_; ros::Subscriber sub_; public: TomatoBroa...
```c++ #include <ros/ros.h> #include <tf2_ros/transform_broadcaster.h> #include <geometry_msgs/PoseStamped.h> #include <geometry_msgs/TransformStamped.h> class TomatoBroadcaster { tf2_ros::TransformBroadcaster broadcaster_; geometry_msgs::TransformStamped transform_; ros::Subscriber sub_; public: TomatoBroad...
ca415956-a303-4ed3-85f6-e4c4b35edd44
{ "language": "C++" }
```c++ #include "application.h" #include "Adafruit_LEDBackpack.h" Adafruit_8x8matrix matrix1; Adafruit_8x8matrix matrix2; Adafruit_8x8matrix matrix3; static const uint8_t smile[] = { 0b00111100, 0b01000010, 0b10100101, 0b10000001, 0b10100101, 0b10011001, 0b01000010, 0b00111100 }; void setup() { Wir...
```c++ #include "application.h" #include "Adafruit_LEDBackpack.h" Adafruit_8x8matrix matrix1; Adafruit_8x8matrix matrix2; Adafruit_8x8matrix matrix3; static const uint8_t smile[] = { 0b00111100, 0b01000010, 0b10100101, 0b10000001, 0b10100101, 0b10011001, 0b01000010, 0b00111100 }; int currentTemperatu...
be0b7a11-bfa9-4131-bf8c-754a67613a8b
{ "language": "C++" }
```c++ #include "../../include/base/ErrorInfo.hpp" namespace cutehmi { namespace base { QString ErrorInfo::toString() const { QString result = str; result += "\n[error class: "; result += errClass; result += " code: "; result += code; result += "]"; return result; } } } //(c)MP: Copyright © 2017, Michal Poli...
```c++ #include "../../include/base/ErrorInfo.hpp" namespace cutehmi { namespace base { QString ErrorInfo::toString() const { QString result = str; result += "\n[error class: "; result += errClass; result += " code: "; result += QString::number(code); result += "]"; return result; } } } //(c)MP: Copyright © ...
6cc6c278-5ed6-402a-95a3-8259bdb751be
{ "language": "C++" }
```c++ //===--- Heap.cpp - Swift Language Heap Logic -----------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swif...
```c++ //===--- Heap.cpp - Swift Language Heap Logic -----------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swif...
3c529dca-3649-44e8-8323-2101c087f7fa
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
790b6f22-84f8-4218-a4bc-34da6acd5f0b
{ "language": "C++" }
```c++ #include "erlang_v8_drv.h" Persistent<ObjectTemplate> GlobalFactory::Generate(Vm *vm, ErlNifEnv *env) { TRACE("GlobalFactory::Generate\n"); Locker locker(vm->isolate); TRACE("GlobalFactory::Generate - 1\n"); Isolate::Scope iscope(vm->isolate); TRACE("GlobalFactory::Generate - 2\n"); HandleScope ...
```c++ #include "erlang_v8_drv.h" Persistent<ObjectTemplate> GlobalFactory::Generate(Vm *vm, ErlNifEnv *env) { TRACE("GlobalFactory::Generate\n"); Locker locker(vm->isolate); TRACE("GlobalFactory::Generate - 1\n"); Isolate::Scope iscope(vm->isolate); TRACE("GlobalFactory::Generate - 2\n"); HandleScope ...
6bdada1a-1d5d-49a0-97f5-457c081bc371
{ "language": "C++" }
```c++ /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
```c++ /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
85e8e0cf-5374-46a6-baf2-901cfbabce18
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
```c++ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
f022c306-f528-4c27-9380-e060af93af61
{ "language": "C++" }
```c++ #include <ros/ros.h> #include <tf2_ros/transform_broadcaster.h> #include <geometry_msgs/TransformStamped.h> #include <geometry_msgs/Point.h> void pointCallback(const geometry_msgs::Point::ConstPtr& msg) { static tf2_ros::TransformBroadcaster br; geometry_msgs::TransformStamped transformStamped; transfo...
```c++ #include <ros/ros.h> #include <tf2_ros/transform_broadcaster.h> #include <geometry_msgs/TransformStamped.h> #include <geometry_msgs/Point.h> int offsetX, offsetY, offsetZ; void pointCallback(const geometry_msgs::Point::ConstPtr& msg) { static tf2_ros::TransformBroadcaster br; geometry_msgs::TransformStampe...
ac4770e9-5943-46d4-9de6-ea3887663879
{ "language": "C++" }
```c++ #include "qmljspreviewrunner.h" #include <projectexplorer/environment.h> #include <utils/synchronousprocess.h> #include <QtGui/QMessageBox> #include <QtGui/QApplication> #include <QDebug> namespace QmlJSEditor { namespace Internal { QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) : QObject(paren...
```c++ #include "qmljspreviewrunner.h" #include <projectexplorer/environment.h> #include <utils/synchronousprocess.h> #include <QtGui/QMessageBox> #include <QtGui/QApplication> #include <QDebug> namespace QmlJSEditor { namespace Internal { QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) : QObject(paren...
e6fe15f6-fcb6-430c-adab-5a942f51b811
{ "language": "C++" }
```c++ #include <znc/Client.h> #include <znc/Modules.h> #include <znc/IRCNetwork.h> #include <znc/IRCSock.h> class CPrioritySend : public CModule { public: MODCONSTRUCTOR(CPrioritySend) {} virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage) override { return ProcessMessage("NOTICE", sTarget, sMessa...
```c++ #include <znc/Client.h> #include <znc/Modules.h> #include <znc/IRCNetwork.h> #include <znc/IRCSock.h> class CPrioritySend : public CModule { public: MODCONSTRUCTOR(CPrioritySend) {} virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage) override { return ProcessMessage("NOTICE", sTarget, sMessa...
fdb79bea-8ada-445d-8b98-20859c844dd8
{ "language": "C++" }
```c++ /* * GoForward.cpp * * Created on: Mar 25, 2014 * Author: user */ #include "GoBackward.h" GoBackward::GoBackward(Robot* robot):Behavior(robot) { // TODO Auto-generated constructor stub } bool GoBackward::startCondition() { return false; } void GoBackward::action() { } bool GoBackward::stopCondi...
```c++ /* * GoForward.cpp * * Created on: Mar 25, 2014 * Author: user */ #include "GoBackward.h" GoBackward::GoBackward(Robot* robot):Behavior(robot), _steps_count(0) { } bool GoBackward::startCondition() { return true; } void GoBackward::action() { ++_steps_count; _robot->setSpeed(-0.1,0.0); } bool ...
d666f2db-f572-47ca-8c9a-38e7bcf816e9
{ "language": "C++" }
```c++ #include <stdio.h> #include <iostream> /// The main function int main () { std::cout << "Hello !" << std::endl; return 0; }``` Include headers for GLEW and glfw3
```c++ #include <GL/glew.h> // to load OpenGL extensions at runtime #include <GLFW/glfw3.h> // to set up the OpenGL context and manage window lifecycle and inputs #include <stdio.h> #include <iostream> /// The main function int main () { std::cout << "Hello !" << std::endl; return 0; }```
6704383e-8f4a-4768-a80e-ef514d7f5a7a
{ "language": "C++" }
```c++ #include <iostream> #include "configure.hpp" #include "parsers/md_parser.hpp" #include "display_drivers/ncurses_display_driver.hpp" using namespace std; int main(int argc, char ** argv) { cout << "mdl v" << MDL_VERSION_STRING << endl; if (argc < 2) { cerr << "mdl: missing at least one argument" << endl; ...
```c++ #include "configure.hpp" #include "parsers/md_parser.hpp" #include "display_drivers/ncurses_display_driver.hpp" #include <iostream> #include <locale.h> using namespace std; int main(int argc, char ** argv) { setlocale(LC_ALL, ""); cout << "mdl v" << MDL_VERSION_STRING << endl; if (argc < 2) { cerr << "md...
0de0e360-963c-463a-be7e-df0bb2c772db
{ "language": "C++" }
```c++ //===--- MiscTidyModule.cpp - clang-tidy ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
```c++ //===--- MiscTidyModule.cpp - clang-tidy ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
2e6a844c-8111-497d-92bb-227ac56ca6f9
{ "language": "C++" }
```c++ // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // Simple test for a fuzzer: find interesting value of array index. #include <assert.h> #include <cstdint> #include <cstring> #include <cstddef> #include <iostream> static volatile int Sink; const ...
```c++ // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // Simple test for a fuzzer: find interesting value of array index. #include <assert.h> #include <cstdint> #include <cstring> #include <cstddef> #include <iostream> static volatile int Sink; const ...
65072e35-c4aa-4f80-bc55-dd18358121d2
{ "language": "C++" }
```c++ #include "yuyvtoyuv420.h" YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats, std::shared_ptr<HWResourceManager> hwResources) : Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO) {} void YUYVtoYUV420::process() { std::unique_ptr<Data> input...
```c++ #include "yuyvtoyuv420.h" YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats, std::shared_ptr<HWResourceManager> hwResources) : Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO) {} void YUYVtoYUV420::process() { std::unique_ptr<Data> input...
2606d1af-6a95-4eb4-bf9b-2e2ec2b4f5bd
{ "language": "C++" }
```c++ #include "scanner/api/kernel.h" #include "scanner/api/op.h" #include "scanner/util/memory.h" namespace scanner { class DiscardKernel : public BatchedKernel { public: DiscardKernel(const KernelConfig& config) : BatchedKernel(config), device_(config.devices[0]), work_item_size_(config.work_ite...
```c++ #include "scanner/api/kernel.h" #include "scanner/api/op.h" #include "scanner/util/memory.h" namespace scanner { class DiscardKernel : public BatchedKernel { public: DiscardKernel(const KernelConfig& config) : BatchedKernel(config), device_(config.devices[0]), work_item_size_(config.work_ite...
2051c2be-84cd-4395-8c7c-570b509c59bc
{ "language": "C++" }
```c++ // RUN: mkdir -p %T/read-file-config/ // RUN: cp %s %T/read-file-config/test.cpp // RUN: echo 'Checks: "-*,modernize-use-nullptr"' > %T/read-file-config/.clang-tidy // RUN: echo '[{"command": "cc -c -o test.o test.cpp", "directory": "%T/read-file-config", "file": "%T/read-file-config/test.cpp"}]' > %T/read-file-...
```c++ // RUN: mkdir -p %T/read-file-config/ // RUN: cp %s %T/read-file-config/test.cpp // RUN: echo 'Checks: "-*,modernize-use-nullptr"' > %T/read-file-config/.clang-tidy // RUN: echo '[{"command": "cc -c -o test.o test.cpp", "directory": "%/T/read-file-config", "file": "%/T/read-file-config/test.cpp"}]' > %T/read-fil...
1f223d7e-1195-4b95-8881-ca762661b9b8
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -verify %s // XFAIL template<typename T> struct X0 { typedef int size_type; size_type f0() const; }; template<typename T> typename X0<T>::size_type X0<T>::f0() const { } ``` Make the recanonicalization-for-an-out-of-line-definition test case a bit trickier
```c++ // RUN: clang-cc -fsyntax-only -verify %s // XFAIL template<typename T> struct X1 { }; template<typename T> struct X0 { typedef int size_type; typedef T value_type; size_type f0() const; value_type *f1(); X1<value_type*> f2(); }; template<typename T> typename X0<T>::size_type X0<T>::f0() const { ...
33812ffa-96c9-401a-b9ed-d55525e26d3b
{ "language": "C++" }
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i,j,k) i <- d == 0 jnzrel(i, L_done) h <- 1 b <- 0 j <- c >> 31 // save sign bit in j j <- -j // convert sign to flag c <- c ^ j // adjust multiplicand ...
```c++ #include "common.th" // c <- multiplicand // d <- multiplier // b -> product .global imul imul: pushall(h,i,j) i <- d == 0 jnzrel(i, L_done) h <- 1 b <- 0 j <- d >> 31 // save sign bit in j j <- -j // convert sign to flag d <- d ^ j // adjust multiplier d <-...
65b0d103-3243-43eb-8fe4-97f8afe0dcc4
{ "language": "C++" }
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/files/file_path.h" #include "base/path_service.h" #include "base/process/launch.h" #include "base/str...
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/process/launch.h" #include "base/strings/s...
6dd0a822-7fdc-4196-8fc1-dc8769e1a7e9
{ "language": "C++" }
```c++ //===- llvm-xray.cc - XRay Tool Main Program ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- llvm-xray.cc - XRay Tool Main Program ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
5999a30b-64fc-41ec-9af2-4b57fe33a0ff
{ "language": "C++" }
```c++ // Copyright (C) 2018 Elviss Strazdins // This file is part of the Ouzel engine. #include "RenderTargetResourceEmpty.hpp" namespace ouzel { namespace graphics { } // namespace graphics } // namespace ouzel ``` Fix the render target D3D11 include
```c++ // Copyright (C) 2018 Elviss Strazdins // This file is part of the Ouzel engine. #include "RenderTargetResourceD3D11.hpp" namespace ouzel { namespace graphics { } // namespace graphics } // namespace ouzel ```
2a93b613-4f6c-4f5a-935e-b79a8441b22d
{ "language": "C++" }
```c++ #include "AddressPool.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetLoweringObjectFile.h" using namespace llvm; class MCExpr; unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) { auto IterBool = Pool.insert(std::make_pair(Sym, AddressPo...
```c++ //===-- llvm/CodeGen/AddressPool.cpp - Dwarf Debug Framework ---*- C++ -*--===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
ab9789b3-267c-475d-83bf-0ab7072fa94a
{ "language": "C++" }
```c++ #include "CPU.h" #if defined(__x86_64__) || defined(__i386__) #include <cpuid.h> #endif #include "Log.h" #ifndef bit_AES #define bit_AES (1 << 25) #endif #ifndef bit_AVX #define bit_AVX (1 << 28) #endif namespace i2p { namespace cpu { bool aesni = false; bool avx = false; void Detect() { #if defined(__x8...
```c++ #include "CPU.h" #if defined(__x86_64__) || defined(__i386__) #include <cpuid.h> #endif #include "Log.h" namespace i2p { namespace cpu { bool aesni = false; bool avx = false; void Detect() { #if defined(__x86_64__) || defined(__i386__) int info[4]; __cpuid(0, info[0], info[1], info[2], info[3]); if (i...
4dbe22b9-72e6-46af-a5bc-b332e807aaab
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/renderer/renderer_main_platform_delegate.h" #include "base/debug_util.h" // This is a no op class because we do not have a s...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/renderer/renderer_main_platform_delegate.h" #include "base/debug_util.h" // This is a no op class because we do not have a s...
48ed81e6-5e63-4902-b1a8-db88be8525a4
{ "language": "C++" }
```c++ /** * \file * \brief Unit Test for Thermal Mock Config * * \author Uilian Ries <uilianries@gmail.com> */ /** Should not link with unit test lib */ #define BOOST_TEST_NO_LIB #include <string> #include <boost/filesystem.hpp> #include <boost/test/unit_test.hpp> #include <Poco/File.h> #include "bbbgpio/ther...
```c++ /** * \file * \brief Unit Test for Thermal Mock Config * * \author Uilian Ries <uilianries@gmail.com> */ /** Should not link with unit test lib */ #define BOOST_TEST_NO_LIB #include <string> #include <boost/filesystem.hpp> #include <boost/test/unit_test.hpp> #include <boost/filesystem/operations.hpp> #i...
bf766c49-8bf5-425c-928d-8f6bd7cc3d98
{ "language": "C++" }
```c++ // Borrowed reference to QtGui module extern PyObject* moduleQtGui; int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) { int numArgs = PyTuple_GET_SIZE(args); if (numArgs != 1) { PyErr_BadArgument(); return -1; } char** argv; int argc; if (!PySequence_to...
```c++ // Borrowed reference to QtGui module extern PyObject* moduleQtGui; int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) { if (QApplication::instance()) { PyErr_SetString(PyExc_RuntimeError, "A QApplication instance already exists."); return -1; } int numArgs = PyTupl...
bb45db9a-f512-41b0-9cd5-535b2accbb33
{ "language": "C++" }
```c++ /* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ // A benchmark designed to isolate the constant overheads of picture recording. // We record a very tiny (one op) picture; one op is better than none, as it forces // u...
```c++ /* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ // A benchmark designed to isolate the constant overheads of picture recording. // We record an empty picture and a picture with one draw op to force memory allocation....
1eb638f5-94ae-424c-8f03-7e22ba76e261
{ "language": "C++" }
```c++ // StackTrace.cpp // Implements the functions to print current stack traces #include "Globals.h" #include "StackTrace.h" #ifdef _WIN32 #include "../StackWalker.h" #else #include <execinfo.h> #include <unistd.h> #endif // FreeBSD uses size_t for the return type of backtrace() #if defined(__FreeBSD__) && (_...
```c++ // StackTrace.cpp // Implements the functions to print current stack traces #include "Globals.h" #include "StackTrace.h" #ifdef _WIN32 #include "../StackWalker.h" #else #ifdef __GLIBC__ #include <execinfo.h> #endif #include <unistd.h> #endif // FreeBSD uses size_t for the return type of backtrace() #if...
825f61cc-af8d-4541-b69a-b90540b8b2a6
{ "language": "C++" }
```c++ #include "ofMain.h" #include "ofApp.h" int main() { #ifdef TARGET_RASPBERRY_PI ofSetupOpenGL(600, 500, OF_FULLSCREEN); #else ofSetupOpenGL(600, 500, OF_WINDOW); #endif ofRunApp(new ofApp()); }``` Add -f flag option to RPi version of he example
```c++ #include "ofMain.h" #include "ofApp.h" #include <string> #ifdef TARGET_RASPBERRY_PI // Accept arguments in the Pi version int main(int argc, char* argv[]) { bool fullscreen = false; if (argc > 0) { std::string fullscreenFlag = "-f"; for (int i = 0; i < argc; i++) { if (strcmp(argv[i], fu...
664624a8-d241-403a-9f9d-47e2db6f3f19
{ "language": "C++" }
```c++ #include <iostream> #include <tcp_server.hpp> int main() { TcpServer server(12001); server.Listen(2000); return 0; } ``` Update tcp server example to accept cmd args
```c++ #include <iostream> #include <tcp/tcp_server.hpp> #include <sstream> int main(int argc, char** argv) { //initalize default port number and max connection cout int port = 12001, max_connection_count= 1000; // check if there are any passed arguments if(argc > 1) { // initialize string stream from a...
dc9b0402-9e56-4eb1-b928-3c85d94c354b
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only -verify %s struct S { }; template<typename T> void f1(T a, T b = 10) { } // expected-error{{cannot initialize 'b' with an rvalue of type 'int'}} template<typename T> void f2(T a, T b = T()) { } template<typename T> void f3(T a, T b = T() + T()); // expected-error{{invalid opera...
```c++ // RUN: clang-cc -fsyntax-only -verify %s struct S { }; template<typename T> void f1(T a, T b = 10) { } // expected-error{{cannot initialize 'b' with an rvalue of type 'int'}} template<typename T> void f2(T a, T b = T()) { } template<typename T> void f3(T a, T b = T() + T()); // expected-error{{invalid opera...
2805da97-7547-410e-8e5d-00828d94a429
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "servicelayercomponent.h" #include <vespa/storage/common/content_bucket_space_repo.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/vdslib/distribution/distributi...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "servicelayercomponent.h" #include <vespa/storage/common/content_bucket_space_repo.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/vdslib/distribution/distributi...
aaa7e7fc-2200-4509-bc54-f962cca01d13
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -emit-llvm namespace test0 { template <typename T> struct X { virtual void foo(); virtual void bar(); virtual void baz(); }; template <typename T> void X<T>::foo() {} template <typename T> void X<T>::bar() {} template <typename T> void X<T>::baz() {} template <> void X<char>::foo()...
```c++ // RUN: %clang_cc1 %s -emit-llvm-only namespace test0 { template <typename T> struct X { virtual void foo(); virtual void bar(); virtual void baz(); }; template <typename T> void X<T>::foo() {} template <typename T> void X<T>::bar() {} template <typename T> void X<T>::baz() {} template <> void X<char>::...
98930b77-194a-4045-9441-50a3798415e2
{ "language": "C++" }
```c++ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
```c++ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
291d9875-60e3-4c00-a2c8-e1173b7de1f9
{ "language": "C++" }
```c++ #include <avr/io.h> #include <avr/interrupt.h> /* _____ ___ ___ RESET -| U |- VCC (Mode) ADC3 -| AT13A |- ADC1 (Depth) (Speed) ADC2 -| |- OC0B (PWM Output) GND -|_______|- PB0 (Button) */ int main() { while(1) { cli(); ...
```c++ #include <avr/io.h> #include <avr/interrupt.h> /* _____ ___ ___ RESET -| U |- VCC (Mode) ADC3 -| AT13A |- ADC1 (Depth) (Speed) ADC2 -| |- OC0B (PWM Output) GND -|_______|- PB0 (Button) */ enum { ADC_DEPTH = 1, ADC_SPEED = 2, ADC...
c42c81a3-c4ed-438e-ac33-a9ab0f79e087
{ "language": "C++" }
```c++ /** * Copyright (c) 2016-present, Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appl...
```c++ /** * Copyright (c) 2016-present, Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appl...
21c70d71-7a77-4ed3-842f-cb1e74f35cf8
{ "language": "C++" }
```c++ #include "generator/sponsored_scoring.hpp" #include "generator/opentable_dataset.hpp" #include "generator/feature_builder.hpp" namespace { // Calculated with tools/python/booking_hotels_quality.py. double constexpr kOptimalThreshold = 0.304875; } // namespace namespace generator { namespace sponsored_scoring...
```c++ #include "generator/sponsored_scoring.hpp" #include "generator/opentable_dataset.hpp" #include "generator/feature_builder.hpp" namespace { // Calculated with tools/python/booking_hotels_quality.py. double constexpr kOptimalThreshold = 0.312887; } // namespace namespace generator { namespace sponsored_scoring...
c592fe8e-1c2c-4834-9f2f-140dc253a3c7
{ "language": "C++" }
```c++ // Copyright (c) 2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <amount.h> #include <optional.h> #include <policy/fees.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test...
```c++ // Copyright (c) 2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <amount.h> #include <optional.h> #include <policy/fees.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test...
d62188c2-014f-4b1e-abcb-e118b1fe08bd
{ "language": "C++" }
```c++ #include "alnindex.hpp" #include <cstring> AlnIndex::AlnIndex() { t = hattrie_create(); } AlnIndex::~AlnIndex() { hattrie_free(t); } size_t AlnIndex::size() const { return hattrie_size(t); } void AlnIndex::clear() { hattrie_clear(t); } long AlnIndex::add(const char* key) { value_t*...
```c++ #include "alnindex.hpp" #include <cstring> AlnIndex::AlnIndex() { t = hattrie_create(); } AlnIndex::~AlnIndex() { hattrie_free(t); } size_t AlnIndex::size() const { return hattrie_size(t); } void AlnIndex::clear() { hattrie_clear(t); } long AlnIndex::add(const char* key) { value_t*...
a4dc2ce4-c03d-44ad-b0cb-6d4970fffe30
{ "language": "C++" }
```c++ #include <QCoreApplication> #include <QSettings> #include "Application.h" int main(int argc, char *argv[]) { Application a(argc, argv); return a.exec(); } ``` Add color and timestamp to loggin messages
```c++ #include <QCoreApplication> #include <QSettings> #include "Application.h" #include <QtGlobal> #include <QTime> #include <iostream> #define COLOR_LIGHTRED "\033[31;1m" #define COLOR_RED "\033[31m" #define COLOR_LIGHTBLUE "\033[34;1m" #define COLOR_BLUE "\033[34m" #define COLOR_GREEN "\033[32;1m...
0a7cef1c-62c4-43b5-ad57-6639d027b531
{ "language": "C++" }
```c++ #include <string> #include <config/config.h> #include <config/config_type_pointer.h> #include <config/config_value.h> ConfigTypePointer config_type_pointer; bool ConfigTypePointer::set(ConfigValue *cv, const std::string& vstr) { if (pointers_.find(cv) != pointers_.end()) return (false); Config *config = ...
```c++ #include <string> #include <config/config.h> #include <config/config_type_pointer.h> #include <config/config_value.h> ConfigTypePointer config_type_pointer; bool ConfigTypePointer::set(ConfigValue *cv, const std::string& vstr) { if (pointers_.find(cv) != pointers_.end()) return (false); /* XXX Have a mag...
20a44a34-135c-4eed-8c9a-3ff2a3a49583
{ "language": "C++" }
```c++ #include <cassert> #include "structures/congruence_atom.h" using namespace theorysolver; Term::Term(unsigned int symbol_id) : type(Term::SYMBOL), symbol_id(symbol_id), function_name(), arguments() { } Term::Term(std::string function_name, std::vector<std::shared_ptr<Term>> arguments) : type(Term::FUNCTION), s...
```c++ #include <cassert> #include "structures/congruence_atom.h" using namespace theorysolver; Term::Term(unsigned int symbol_id) : type(Term::SYMBOL), symbol_id(symbol_id), function_name(), arguments() { } Term::Term(std::string function_name, std::vector<std::shared_ptr<Term>> arguments) : type(Term::FUNCTION), s...
90d1ff73-cf52-4a4f-bd30-4e49881481c1
{ "language": "C++" }
```c++ #include <iostream> #include <limits> #include <bitset> std::bitset<10> split(unsigned number) noexcept { std::bitset<10> result; while (number > 0) { unsigned digit = number % 10; number /= 10; result[digit] = true; } return re...
```c++ #include <iostream> #include <limits> #include <bitset> std::bitset<10> split(unsigned number) noexcept { std::bitset<10> result; while (number > 0) { unsigned digit = number % 10; number /= 10; result[digit] = true; } return re...
7c0891d8-df53-4137-a2d4-080da1ebad1f
{ "language": "C++" }
```c++ #include <ncurses.h> #include <stdlib.h> #include <time.h> #include "lightsout.hpp" namespace roadagain { board::board(int width, int height) : width(width), height(height) { // init seed of rand() by current time srand(time(NULL)); lights = new bool*[height + 2](); for (int i = 0; i < height...
```c++ #include <ncurses.h> #include <stdlib.h> #include <time.h> #include "lightsout.hpp" #include "print.hpp" namespace roadagain { board::board(int width, int height) : width(width), height(height) { // init seed of rand() by current time srand(time(NULL)); lights = new bool*[height + 2](); for (...
e6216509-0e69-49c8-94c0-caab299af75a
{ "language": "C++" }
```c++ #include "coincontroltreewidget.h" #include "coincontroldialog.h" CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) : QTreeWidget(parent) { } void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox { ...
```c++ #include "coincontroltreewidget.h" #include "coincontroldialog.h" CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) : QTreeWidget(parent) { } void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox { ...
3ac87d5a-a673-4e41-a961-0387a9fd4206
{ "language": "C++" }
```c++ #include "instr.h" #define MIPS_JTYPE_EXTRACT_TARGET(Instr) (Instr & ((1 << 26) - 1)) namespace sasm { namespace instr { namespace mips { namespace jtype { jtype_instr::jtype_instr(const sasm::elf::elf& elf, uint64 addr) : mips_instr(elf, addr) { auto instr = elf.image.read<uint32>(addr); _target_val =...
```c++ #include "instr.h" #define MIPS_JTYPE_EXTRACT_TARGET(Instr) (Instr & ((1 << 26) - 1)) namespace sasm { namespace instr { namespace mips { namespace jtype { jtype_instr::jtype_instr(const sasm::elf::elf& elf, uint64 addr) : mips_instr(elf, addr) { auto instr = elf.image.read<uint32>(addr); _target_val =...
cbe8d6ef-e8bd-4e9f-b993-f100abfb01f4
{ "language": "C++" }
```c++ #include <stan/math/prim/mat.hpp> #include <gtest/gtest.h> TEST(MathMatrixPrimMat, singular_values) { stan::math::matrix_d m0(1, 1); m0 << 1.0; using stan::math::singular_values; EXPECT_NO_THROW(singular_values(m0)); } ``` Add prim test for size zero input
```c++ #include <stan/math/prim/mat.hpp> #include <gtest/gtest.h> TEST(MathMatrixPrimMat, singular_values) { using stan::math::singular_values; stan::math::matrix_d m0(0, 0); EXPECT_NO_THROW(singular_values(m0)); stan::math::matrix_d m1(1, 1); m1 << 1.0; EXPECT_NO_THROW(singular_values(m1)); } ```
47eb7460-cd1c-4be8-b485-e7f55dea433f
{ "language": "C++" }
```c++ #include <functional> #include "apsp.h" #include "cuda/cuda_apsp.cuh" /** * Naive implementation algorithm Floyd Wharshall for APSP * * @param data: unique ptr to graph data with allocated fields */ static void naiveFW(const std::unique_ptr<graphAPSPTopology>& data) { int newPath = 0; int n = data-...
```c++ #include <functional> #include "apsp.h" #include "cuda/cuda_apsp.cuh" /** * Naive implementation algorithm Floyd Wharshall for APSP * * @param data: unique ptr to graph data with allocated fields */ static void naiveFW(const std::unique_ptr<graphAPSPTopology>& data) { int newPath = 0; int n = data-...
40ba7bca-ccfb-4d3a-8ca4-975accfbce57
{ "language": "C++" }
```c++ #include <iostream> #include <tightdb/util/terminate.hpp> using namespace std; namespace tightdb { namespace util { TIGHTDB_NORETURN void terminate(string message, const char* file, long line) TIGHTDB_NOEXCEPT { cerr << file << ":" << line << ": " << message << endl; abort(); } } // namespace util...
```c++ #include <iostream> #ifdef __APPLE__ #include <execinfo.h> #endif #include <tightdb/util/terminate.hpp> using namespace std; namespace tightdb { namespace util { TIGHTDB_NORETURN void terminate(string message, const char* file, long line) TIGHTDB_NOEXCEPT { cerr << file << ":" << line << ": " << messag...
5c0dcaab-1872-4333-80b8-aacae0effb15
{ "language": "C++" }
```c++ #include "MainWindow.h" #include <QApplication> namespace cygnus { class MainApp : public QApplication { QString fileName_{}; MainWindow *mainWindow_; public: MainApp(int argc, char *argv[]) : QApplication(argc, argv), mainWindow_(new MainWindow()) { mainWindow_->showMaximized(); if (arg...
```c++ #include "MainWindow.h" #include <QApplication> namespace cygnus { class MainApp : public QApplication { QString fileName_{}; MainWindow *mainWindow_; public: MainApp(int argc, char *argv[]) : QApplication(argc, argv), mainWindow_(new MainWindow()) { mainWindow_->showMaximized(); QApplica...
f0183ecd-fce2-482c-a238-c83ca85d30c0
{ "language": "C++" }
```c++ #include "../include/parser.h" #include "../include/exceptions.h" int main(int argc, const char** argv) { if(argc != 2) { printf("Arguments: file name.\n"); exit(1); } else { try { FileAccess * file = new FileAccess(argv[1]); TextCursor ...
```c++ #include "../include/parser.h" #include "../include/exceptions.h" int main(int argc, const char** argv) { if(argc != 2) { printf("Arguments: file name.\n"); return 1; } else { try { FileAccess * file = new FileAccess(argv[1]); TextCursor...
2a1434c5-17d2-4227-b0ff-299b4c037f5a
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s struct A {}; // expected-note {{candidate is the implicit copy constructor}} struct BASE { operator A(); // expected-note {{candidate function}} }; struct BASE1 { operator A(); // expected-note {{candidate function}} }; class B : public BASE , public...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s struct A {}; // expected-note {{candidate is the implicit copy constructor}} struct BASE { operator A(); // expected-note {{candidate function}} }; struct BASE1 { operator A(); // expected-note {{candidate function}} }; class B : public BASE , public...
1009b523-11a6-4496-bbd5-ceb11040b0a0
{ "language": "C++" }
```c++ #include <cstdint> #include <Magick++/Blob.h> #include <Magick++/Image.h> #include "utils.cc" #define FUZZ_ENCODER_STRING_LITERAL_X(name) FUZZ_ENCODER_STRING_LITERAL(name) #define FUZZ_ENCODER_STRING_LITERAL(name) #name #ifndef FUZZ_ENCODER #define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL_X(FUZZ_IMAGEMAGICK_E...
```c++ #include <cstdint> #include <Magick++/Blob.h> #include <Magick++/Image.h> #include "utils.cc" #define FUZZ_ENCODER_STRING_LITERAL_X(name) FUZZ_ENCODER_STRING_LITERAL(name) #define FUZZ_ENCODER_STRING_LITERAL(name) #name #ifndef FUZZ_ENCODER #define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL_X(FUZZ_IMAGEMAGICK_E...
03b6a633-9277-4967-9c6e-e31c9c8a731d
{ "language": "C++" }
```c++ #include "Hostname.hpp" Hostname::Hostname() { } Hostname::Hostname(const ci_string& hostname) { create(hostname); } bool Hostname::isValid() { return !data.empty(); } void Hostname::create(const ci_string & hostname) { if (isValid()) { throw std::runtime_error("Hostname is defined!")...
```c++ #include "Hostname.hpp" Hostname::Hostname() { } Hostname::Hostname(const ci_string& hostname) { create(hostname); } bool Hostname::isValid() { return !data.empty(); } void Hostname::create(const ci_string & hostname) { if (isValid()) { throw std::runtime_error("Hostname is defined!")...
29ecdc24-0e5f-4f91-8b7a-e60cb100dbd0
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "Test.h" // This is a GPU-backend specific test #if SK_SUPPORT_GPU #include "GrContextFactory.h" DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { ...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "Test.h" // This is a GPU-backend specific test #if SK_SUPPORT_GPU #include "GrContextFactory.h" DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { ...