* remove `using namespace std;` and fix resulting errors with missing namespaces * remove `using namespace Eigen;` and fix resulting errors with missing namespaces This should fix issues like https://github.com/libigl/libigl/issues/2480 * Add missing namespaces fixup for9ef213ba34fixup for3e88aa04fd* missing Eigen:: * missing std:: * more missing std:: --------- Co-authored-by: BruegelN <bruegeln@crashing.systems>
38 lines
961 B
C++
38 lines
961 B
C++
// This file is part of libigl, a simple c++ geometry processing library.
|
|
//
|
|
// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
|
|
//
|
|
// 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 "next_filename.h"
|
|
#include "STR.h"
|
|
#include "file_exists.h"
|
|
#include <cmath>
|
|
#include <iomanip>
|
|
|
|
bool igl::next_filename(
|
|
const std::string & prefix,
|
|
const int zeros,
|
|
const std::string & suffix,
|
|
std::string & next)
|
|
{
|
|
// O(n), for huge lists could at least find bounds with exponential search
|
|
// and then narrow with binary search O(log(n))
|
|
int i = 0;
|
|
while(true)
|
|
{
|
|
next = STR(prefix << std::setfill('0') << std::setw(zeros)<<i<<suffix);
|
|
if(!file_exists(next))
|
|
{
|
|
return true;
|
|
}
|
|
i++;
|
|
if(zeros > 0 && i >= pow(10,zeros))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|