| Directory: | ./ |
|---|---|
| File: | src/StreambufLayer.cpp |
| Date: | 2025-02-12 12:41:42 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 12 | 12 | 100.0% |
| Branches: | 3 | 4 | 75.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (C) 2015-2016 Richard Hacker (lerichi at gmx dot net) | ||
| 4 | * | ||
| 5 | * This file is part of the PdCom library. | ||
| 6 | * | ||
| 7 | * The PdCom library is free software: you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU Lesser General Public License as published by | ||
| 9 | * the Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * The PdCom library is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
| 15 | * License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public License | ||
| 18 | * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | *****************************************************************************/ | ||
| 21 | |||
| 22 | #include "StreambufLayer.h" | ||
| 23 | |||
| 24 | using namespace PdCom::impl; | ||
| 25 | |||
| 26 | /////////////////////////////////////////////////////////////////////////// | ||
| 27 |
1/2✓ Branch 7 taken 67 times.
✗ Branch 8 not taken.
|
67 | StreambufLayer::StreambufLayer(IOLayer *parent) : IOLayer(parent) |
| 28 | 67 | {} | |
| 29 | |||
| 30 | |||
| 31 | /////////////////////////////////////////////////////////////////////////// | ||
| 32 | 3864 | int StreambufLayer::overflow(int i) | |
| 33 | { | ||
| 34 | 3864 | char c = i; | |
| 35 |
2/2✓ Branch 4 taken 3861 times.
✓ Branch 5 taken 3 times.
|
3864 | IOLayer::write(&c, 1); |
| 36 | 3861 | return c; | |
| 37 | } | ||
| 38 | |||
| 39 | /////////////////////////////////////////////////////////////////////////// | ||
| 40 | 3048 | std::streamsize StreambufLayer::xsputn(const char *s, std::streamsize n) | |
| 41 | { | ||
| 42 | 3048 | IOLayer::write(s, n); | |
| 43 | 3046 | return n; | |
| 44 | } | ||
| 45 | |||
| 46 | /////////////////////////////////////////////////////////////////////////// | ||
| 47 | 257 | int StreambufLayer::sync() | |
| 48 | { | ||
| 49 | 257 | IOLayer::flush(); | |
| 50 | 257 | return 0; | |
| 51 | } | ||
| 52 |