Questions tagged [wrapper]

A wrapper is an OOP technique where an object encapsulates (wraps) another object, hiding/protecting the object and controlling all access to it.

Filter by
Sorted by
Tagged with
7
votes
2answers
16k views

Wrapping tuples to be used as keys in a Dictionary

I'm currently working on a project where I have to map some objects to several properties. Basically I need a Dictionary with Tuples as keys and instances of MyClass as values. As using tuples can ...
3
votes
1answer
2k views

.NET MSSQL Wrapper

Back in late 2012, I wrote the following C# .NET MSSQL Wrapper, which offered the following operations: ExecuteScalar (for selecting single field from a row) ...
5
votes
2answers
965 views

Wrapper class for PHPMailer

Is this a right way to use/implement an external library into a project? If it's not how do you do it? ...
1
vote
0answers
160 views

Follow-up: Window Creation Wrapper Class

This is the revised version of the Window Creation Wrapper Class. I tried to improve the code due to the remarks of @user1118321 (see posted link) and I hope for further reviews. For instance, you ...
4
votes
2answers
303 views

Wrapper class for adding elements to HashSet

I have many object of class Test. I want to be sure that among them, there are no two objects o1 and ...
4
votes
1answer
1k views

Window Creation Wrapper Class

This Question now has a follow-up here I don't think that there is any new technique in my code but in my opinion it's ok all in all (with a bit of magic). Maybe you can find something to improve or ...
4
votes
1answer
314 views

Angular wrapper for SignalR event aggregator

I created a little wrapper for one of my JavaScript libraries to enable Angular functionality. Are there any pitfalls I should be wary of with my code? ...
15
votes
1answer
544 views

Event-based Xbox Controller polling

The goal of the following code is to be able to use an Xbox Controller in a Java program, it works with the jinput library. Unfortunately this library is rather old, has little to no documentation ...
3
votes
1answer
138 views

RAII style API wrapper for PyMongo

I just watched Raymond Hettinger's talk on making Python more Pythonic and realized I should be putting a lot of his ideas into practice, particularly wrapping API's in a class that makes everything ...
4
votes
2answers
603 views

Encryption wrapper

I am writing an encryption class using Crypto++. The idea is that the client connects using RSA (encrypt, decrypt) with username, password, 32 byte key. The server will then return using the stream ...
3
votes
2answers
603 views

BigDecimal wrapper that ignores zero operands

I want to perform mathematical operations on a range of values, where zeros should be ignored. This means that multiplication by zero does not result in zero but returns the first operand and likewise ...
2
votes
1answer
64 views

Simple DB API for inserting a record

I'm looking to make some improvements to a deliberately crude API written in PHP, it's designed to handle simple requests and talk to the DB. I have the following DB class: ...
2
votes
2answers
424 views

PDO wrapper with validation

After moving from mysql_ to PDO I created a PDO handling function. Basically this function takes parameters, checks them and returns end result. The thing is that I created this ~1 year ago and haven'...
2
votes
1answer
217 views

Throwing exceptions in a database wrapper

I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
4
votes
1answer
742 views

Wrapper library for Google Static Maps API

I've recently read the books Clean Code and Effective Java. I am a huge fan of Object-Oriented Java. I am trying to write as professionally as possible. I have been an Android Developer for 20 months ...
5
votes
2answers
2k views

C++/CLI wrapper around a C library

I have a C library written by a third-party company. It calculates photo positions on a book page, position of a photo inside an area (which part of the photo to crop), it fills a book with random ...
3
votes
3answers
3k views

Simple wrapper for LocalReport

I've built a wrapper for a LocalReport and I would like to hear your suggestions about it: ...
3
votes
3answers
1k views

PDO class and security

I have started a project in PHP with PDO and I'm almost done, but I've read somewhere that PDO escape alone is not secure and we have to consider some settings of PDP. I am a little confused about my ...
1
vote
1answer
2k views

Write to the event log without needing to check whether or not it exists by use of a `-Force` parameter

Below is some powershell to write to the event log; if the -Force parameter is specified this saves you the effort of writing additional code to first check whether ...
4
votes
3answers
986 views

WinSCP IDisposable Wrapper

I have written a simple wrapper for WinSCP in C#. I have written it to simplify SFTP connections I will needing to perform. ...
7
votes
2answers
599 views

Scala BitSet implemented with Java BitSet, for use in Scala Enumerations to replace ValueSet

Due to a performance profiling hotspot detailed here, I implemented my own BitSet using Java's BitSet. This is intended to ...
2
votes
2answers
839 views

“Rational” Wrapper class with support for Rational Number Approximation

Enough with imprecise floating point datatypes called float anddouble. I present to you Rational. Of course, Rational number ...
2
votes
1answer
437 views

Point2D.Double wrapper

I have made a Point2D.Double wrapper so I can add my own functionality (like a dominate method) and alter some (like ...
5
votes
1answer
438 views

Python wrapper for official Hacker News API

Since Hacker News launched their official API, I started working on Python wrapper for it. API v0 is fairly simple, you send a GET request with hacker news story's ID or user id, it returns data in ...
3
votes
1answer
3k views

A wrapper class for Sessions in PHP

I have been using $_SESSION, $_POST, $_GET, $_SERVER ...
4
votes
1answer
75 views

Thin proxy class for hashables

I need some kind of thin wrapper object to mark dictionary keys, like: d = { Required('name'): str, Optional('age'): int, } And these wrappers should behave ...
6
votes
1answer
416 views

Debug log wrapper

I will be adding functionality and most likely additional refactoring, however a stringent review would be welcome before I build it further. I know documentation is probably a bit sparse but, you ...
11
votes
2answers
3k views

Async wrapper around public API

Tear it apart. I'm mostly concerned around the appropriate use of ConfigureAwait(false), and possible poor handling and duplication of the ...
3
votes
1answer
370 views

Neo4J Rest Javascript wrapper

As a toy project, I started evaluating the Neo4J graph database and its Rest interface. I'm trying to write a simple graph visualization in JavaScript. In daily business I'm a Java developer and maybe ...
11
votes
1answer
590 views

Set of wrapper functions for POSIX signal APIs on Linux

Please feel free to comment on the accuracy/validity of the following wrapper source for processing signals using the new POSIX sigaction API. If you feel I'm doing anything wrong or potentially ...
10
votes
1answer
382 views

Correct usage of alignas in std::ostringstream wrapper

Please take a look at this code: ...
7
votes
1answer
2k views

OpenGL object wrapped in a Qt Widget

I have this object wrapper class, which I will use to implement my Qt OpenGL scene. It is working, but I am looking for a way to: Improve the API. Remove extra OpenGL calls. Optimize it. I know that ...
6
votes
1answer
1k views

PHP wrapper around an API - best practices

Here's a PHP wrapper around a public OAuth2 REST API. I would love to hear your thoughts and comments. Testing was a bit frustrating since I tried for my first time. Not sure if I have done the ...
3
votes
2answers
1k views

Structure of API wrapper

I'm building an API wrapper for a bookkeeping SOAP API. I have some questions regarding bast practice for structure of the wrapper and for error handling. For now i've structured it like this: ...
4
votes
1answer
4k views

Creating a reusable C#.NET Oracle Query Builder

I write a metric ton of queries for an Oracle environment every day. These are reports that often require multiple separate queries that no end of joins and sub-queries will satisfy, hence lots of ...
6
votes
2answers
843 views

Critique of realloc() wrapper

Seeking code correctness and best practices. I would like to re-allocate various amounts of memory (0 or more) such that on systems that may return NULL for an ...
5
votes
2answers
5k views

Wrapper around default shared preferences in Android

Retrieving an instance of (Default) SharedPreferences and then calling the six methods that may be called to put/get a value gets pretty old pretty quickly, so I ...
1
vote
1answer
770 views

Wrapper for caching methods in ASP.NET

I have written a caching wrapper method for some of my services. The actual wrapper method is written as follows: ...

1 2
3